Lily is a fun-loving girl. She often plays strange games with Kaguya.
Today, they are playing a game called nim. Specifically, the rules of the nim game are as follows:
- There are several rows of chess pieces with known counts. Two players take turns removing any positive integer number of pieces from any single row.
- Lily goes first. The player who cannot make a move loses, which means the player who removes the last piece wins.
Because the optimal strategy is very simple, they started to get bored after a few rounds. So, they added a rule to the original game:
- In a row with $x$ pieces, one can remove $y$ pieces if and only if $y^k \le x$.
Now the game has become interesting. However, because the strategy is quite complex, Lily often feels overwhelmed when calculating.
It can be proven that for any state of this game, either Lily has a winning strategy or Kaguya has a winning strategy.
Therefore, Lily wants you to write a program to calculate who has a winning strategy for a given state (Lily always goes first), so that she can analyze which move was a mistake during the review.
Since all states are derived from reviewing the same game, the parameter $k$ is the same for all queries.
The form of the states queried in this problem is quite special; see the Input section for details.
Input
The first line of input contains two integers $t$ and $k$, representing the number of queries and the parameter in the operation, respectively.
Next, each query is entered sequentially. For each query:
The first line contains an integer $n$.
The second line contains $n$ integers $a_1, \dots, a_n$.
$(n, a_{1 \dots n})$ represents that there are $\sum a_i$ rows of pieces, with the number of pieces in each row being $1 \dots a_1, 1 \dots a_2, \dots, 1 \dots a_n$.
If you are familiar with game theory, it is not difficult to find that the problem can be transformed into:
- Let the Grundy value of a row with $x$ pieces be $g(x)$, and let $h(x)$ be the prefix XOR sum of $g(x)$. Determine whether the XOR sum of $h(a_1) \dots h(a_n)$ is $0$.
Output
For each query, output a string on a single line.
- If Lily has a winning strategy, output
Lily. - If Kaguya has a winning strategy, output
Kaguya.
Examples
Input 1
3 1 2 1 5 3 1 2 3 1 3
Output 1
Kaguya Lily Kaguya
Input 2
4 2 2 1 2 2 1 3 3 5 6 7 1 3
Output 2
Kaguya Lily Kaguya Kaguya
Input 3
See the provided files.
Constraints
For all test data, it is guaranteed that $1 \le k \le 5$, $1 \le n, \sum n \le 10^5$, and $1 \le a_i < 2^{60}$.
The specific limits for each subtask are shown in the table below:
| Subtask ID | $n$ | $k$ | $a_i$ | Special Property | Score |
|---|---|---|---|---|---|
| 1 | $\sum n \le 10^5$ | $k = 1$ | $a_i < 2^{60}$ | 5 | |
| 2 | $\sum n \le 10^5$ | $2 \le k \le 5$ | $a_i < 2^{16}$ | 5 | |
| 3 | $\sum n \le 10^5$ | $2 \le k \le 5$ | $a_i < 2^{22}$ | 10 | |
| 4 | $\sum n \le 10^3$, $n = 2$ | $2 \le k \le 3$ | $a_i < 2^{32}$ | A | 10 |
| 5 | $\sum n \le 10^3$ | $2 \le k \le 5$ | $a_i < 2^{32}$ | A | 10 |
| 6 | $\sum n \le 10^5$ | $k = 2$ | $a_i < 2^{60}$ | A | 10 |
| 7 | $\sum n \le 10^5$ | $k = 3$ | $a_i < 2^{60}$ | A | 10 |
| 8 | $\sum n \le 10^3$ | $k = 2$ | $a_i < 2^{32}$ | 10 | |
| 9 | $\sum n \le 10^3$ | $k = 3$ | $a_i < 2^{32}$ | 10 | |
| 10 | $\sum n \le 10^5$ | $1 \le k \le 5$ | $a_i < 2^{60}$ | 20 |
Special Property A: It is guaranteed that $2 \mid n$ and $a_{2k - 1} = a_{2k} - 1$ for $1 \le k \le \frac n 2$.
Note: If you encounter unexpected TLE, you might want to try optimizing your time complexity.