#P4236. 扑克

扑克

Description

lsq’s deck has no Jokers and contains a total of nn cards. Since wzt is obsessed with exponentiation, he first proposed drawing a2a^2 cards each time (here “^” denotes exponentiation). lsq found that boring, so they changed the rule to drawing aka^k cards each time, where kk is a non-negative integer freely chosen by the player on their turn. lsq starts first, and the two players take turns drawing cards according to the rule. Whoever draws the last card wins.

Since they have plenty of time, lsq and wzt will play qq games in total, each with different aa and nn. wzt banged out some code and can compute the winning strategy once aa and nn are fixed. After seeing your “operations,” lsq hopes you can also write a program to determine whether he can win given aa and nn. Since lsq knows how to play optimally, you do not need to output the specific moves.

Note: In this problem, both players always choose a winning move whenever one exists.

Here kk is a non-negative integer that the player drawing the cards can decide on each turn. You can refer to the sample below for understanding.

Input Format

The first line contains one integer qq, indicating there are qq games.
The next qq lines each contain two integers aa, nn, as defined above.

Output Format

Output qq lines.
If lsq can win, output "lsq Win".
If wzt can win, output "wzt Win".

3
2 5
2 9
3 9
lsq Win
wzt Win
lsq Win

Hint

Constraints:

  • For 30% of the testdata, q30q \le 30, a30a \le 30, n108n \le 10^8.
  • For 50% of the testdata, q50q \le 50, a30a \le 30, n1012n \le 10^{12}.
  • For 100% of the testdata, q50000q \le 50000, a20000a \le 20000, n10500n \le 10^{500}.

Explanation for Sample 1:

  • Query 1: lsq is guaranteed to win. lsq first draws 21=22^1 = 2. Afterwards, no matter whether wzt draws 21=22^1 = 2 or 20=12^0 = 1, lsq can take all the remaining cards. Other draw orders are similar (just a different order).
  • Query 2: wzt is guaranteed to win. If lsq first draws 20=12^0 = 1, then wzt draws 23=82^3 = 8. If lsq first draws 21=22^1 = 2, then wzt draws 22=42^2 = 4. Afterwards, no matter whether lsq draws 21=22^1 = 2 or 20=12^0 = 1, wzt can take all the remaining cards. Other draw orders are similar (just a different order).
  • Query 3: lsq is guaranteed to win; he only needs to take 32=93^2 = 9.

By Broadway

Translated by ChatGPT 5