time limit per test: 0.25 sec. memory limit per test: 4096 KB
input: standard input output: standard output
Little boy Petya plays a game with his friend. They have a heap that consists of N (1<=N<=10^9) matches. It is possible to take 1,P1,P2,...,Pm (2<=Pi<=9, 0<=m<=8) matches from the heap. Players take matches from the heap one by one. The player who takes the last match looses. Petya proved that for any set of N and Pi one of players has winning strategy, i.e. set of rules driving to a victory independently of opponent's moves. You task is to discover who has this strategy.
Input file consist of K test cases. Natural number K is written in the first line. Every test case describes one game: numbers N and M are written in first line of every test case, and second line contains sequence Pi. All numbers in then input are integer numbers. So, if K=2, then second and third lines describe first game and fourth and fifth lines describe second game.
For each test case write in the output file phrase FIRST PLAYER MUST WIN if first player have winning strategy, and SECOND PLAYER MUST WIN therwise.
1 5 3 2 3 5
SECOND PLAYER MUST WIN
Andrew V. Lazarev
Saratov Subregional School Team Contest, 2002
Codeforces (c) Copyright 2010-2021 Mike Mirzayanov