#671
Unrated
Moorbles
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Bessie and Elsie are playing a game of Moorbles. The game works as follows: Bessie and Elsie each start out with some amount of marbles. Bessie holds out AA of her marbles in her hoof and Elsie guesses if AA is Even or Odd. If Elsie is correct, she wins the AA marbles from Bessie and if she guesses incorrectly, she loses AA of her marbles to Bessie (if Elsie has less than AA marbles, she loses all her marbles). A player loses when they lose all of their marbles.

After some amount of turns in the game, Elsie has NN (1N109)(1 \leq N \leq 10^9) marbles. She thinks it is hard to win, but she is playing to not lose. After being around Bessie enough, Elsie has a good read on Bessie's habits and recognizes that on turn ii, there are only KK (1K4)(1 \leq K \leq 4) different amounts of marbles that Bessie may put out. There are only MM (1M3105)(1 \leq M \leq 3 \cdot 10^5) turns before Bessie gets bored and stops playing. Can you identify a lexicographically minimum turn sequence such that Elsie will not lose, regardless of how Bessie plays?

입력

The first line contains a single integer TT (1T101 \leq T \leq 10) representing the number of test cases. Each test case is described as follows: First, one line containing three integers NN, MM, and KK, representing the number of marbles Elsie has, the number of turns, and the number of potential moves Bessie can make respectively.Then, MM lines where line ii contains KK distinct space separated integers ai,1  ai,2ai,Ka_{i,1} \; a_{i,2} \ldots a_{i,K} (1ai,j1031 \leq a_{i, j} \leq 10^3) representing the possible amounts of marbles that Bessie might play on turn ii. It is guaranteed that the sum of MM over all test cases is at most 31053 \cdot 10^5.

출력

For each test case, output the lexicographically minimum move sequence for Elsie to guarantee not losing, or 1-1 if she will lose. The move sequence should be on a single line and consist of MM space-separated tokens each equal to either "Even" or "Odd".

Note: "Even" is lexicographically smaller than "Odd".

예제 입력 1

2
10 3 2
2 5
1 3
1 3
10 3 3
2 7 5
8 3 4
2 5 6

예제 출력 1

Even Even Odd
-1

예제 입력 2

1
20 8 2
3 5
3 5
3 5
3 5
3 5
3 5
3 5
3 5

예제 출력 2

Even Even Even Odd Even Odd Even Odd

점수

Input 3: M16M \leq 16.Inputs 4-6: M1000M \leq 1000.Inputs 7-12: No further constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.