heaps

Time limit: 0.65s Memory limit: 256MB Input: Output:

Nini and Mimi are playing a game with N heaps of stones and pebbles. Each heap i has BiB_i big stones and SiS_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 i and removing some stones and/or pebbles from it. Formally, one can remove X stones and Y pebbles, where 0XBi0 ≤ X ≤ B_i, 0YSi0 ≤ Y ≤ S_i and X+Y>0X + Y > 0. However, every removed stone must be replaced with at least K pebbles; it can be replaced with any natural number of pebbles not less than K. Thus, in any move where X ≥ 1, first Y pebbles are removed and then the player must add back Z ≥ 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.

Input

From the first line of the standard input, your program should read K and Q. Then Q independent tests with that K will follow. For each test, the first line contains N. The next N lines each have a description of a heap: BiB_i and SiS_i.

Output

On Q 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.

Constraints

  • 1 ≤ Q ≤ 10
  • 1N104 1 ≤ N ≤ 10^4
  • 0K,Bi30000 ≤ K, B_i ≤ 3000
  • 0Si1070 ≤ S_i ≤ 10^7

Subtask 1 (8 points)

  • K = 0
  • Bi=0B_i = 0

Subtask 2 (11 points)

  • K = 0
  • Bi1B_i ≤ 1
  • If B_i = 1, then S_i = 0.

Subtask 3 (12 points)

  • K = 0
  • Bi300B_i ≤ 300

Subtask 4 (18 points)

  • K = 1
  • Bi5B_i ≤ 5

Subtask 5 (18 points)

  • K ≤ 20
  • Bi20B_i ≤ 20

Subtask 6 (10 points)

  • K ≤ 100
  • Bi100B_i ≤ 100

Subtask 7 (11 points)

  • K ≤ 300
  • Bi300B_i ≤ 300

Subtask 8 (12 points)

  • K ≤ 3000
  • Bi3000B_i ≤ 3000

Example

stdin

3 2
2
1 5
3 2
3
0 3
2 1
3 2

stdout

Win
Loss

Log in or sign up to be able to send submissions!