Heaps

아직 제출이 없습니다시간 제한1.2초메모리 제한1024 MB

문제

Nini and Mimi are playing a game with NN heaps of stones and pebbles. Each heap ii has B_iB\_i big stones and S_iS\_i small pebbles. Nini and Mimi take turns performing moves and once a player has no more moves to do, they lose. Each move consists of choosing a non-empty heap 𝑖 and removing some stones and/or pebbles from it. Formally, one can remove XX stones and YY pebbles, where 0XB_i0 ≤ X ≤ B\_i, 0YS_i0 ≤ Y ≤ S\_i and X+Y>0X + Y > 0. However, every removed stone must be replaced with at least KK pebbles; it can be replaced with any natural number of pebbles not less than KK. Thus, in any move where X1X ≥ 1, first YY pebbles are removed and then the player must add back ZKXZ ≥ KX pebbles, which are taken from an infinite supply of pebbles. Nini goes first. Before making her move she wonders whether she can win the game if she plays optimally. Write a program, which answers her question.

입력

From the first line of the standard input, your program should read KK and QQ. Then QQ independent tests with that KK will follow. For each test, the first line contains NN. The next NN lines each have a desription of a heap: B_iB\_i and S_iS\_i.

출력

On QQ lines, your program should output the answers to each of the tests in the order they were given. It should print Win, if Nini can win, and Loss, otherwise.

제한

  • 1Q101 ≤ Q ≤ 10
  • 1N104 1 ≤ N ≤ 10^4
  • 0K,B_i30000 ≤ K, B\_i ≤ 3000
  • 0S_i 1070 ≤ S\_i ≤ 10^7