Day 1: Game Of Golf

3.9

92 votes
Easy
Problem

Mayank is a professional golf player and he is very proud of his golf skills. Akash being Mayank's friend doubts his golf skills.

So one day, to test Mayank’s skills, Akash challenges Mayank to a Game of Golf. But he decides to play with his own rules to make Mayank uncomfortable and reduce his chances of a WIN.
Akash sets the rules of the game as follows:

RULES

  • The golf course is straight and Strokes can be hit only in two directions (either forward or backward).
  • Mayank has to hit exactly three strokes.
  • Akash has made a cross mark on the course at a distance K from the starting point in the forward direction.
  • After Mayank takes three strokes, if the ball gets to the cross mark, Mayank wins. Otherwise, Mayank loses and Akash wins.

GAMEPLAY

  • Mayank hits the ball A units (forward or backward).
  • Then he and Akash go to the ball and Mayank hits it again by B units (forward or backward).
  • He repeats the same process and hits the final shot of C units (forward or backward).

Your job is to find that after three shots are played does Mayank have a chance to win or not.

INPUT
First line of input contains a single integer T, denoting the number of test cases.
First line of each test case contains a positive integer K.
Second line of each test case contains three space separated positive integers A, B and C.

OUTPUT

For each test case, print a single line containing the string "WIN" (without quotes) if Mayank has chances of winning the game, or “LOSE” if he has no chance of winning the game.

CONSTRAINTS

 T  100
 A, B, C, K  2000

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Case 1: For NO combination of exactly three such forward or backward shots he can win.
Case 2: If the first shot is hit forward, second one forward and last one again backward, Mayank wins.

Case 3: Again, no possible way to win.

Case 4: If first shot is hit backward, second one forward and last one gain backward, he wins.

Case 5: If first shot is hit backward, second one also backward and last one forward, he wins.

Editor Image

?