Kelvin and Dreamoon love eating cakes.
One day they bought many cakes.
They felt that merely eating the cake is boring, so they decided to play a
small game while eating. (They love to challenge each other as much as they
love eating cake!)
There are a total of N rectangular cakes, each with integer length Li and width Wi.
They take turn eating, with Kelvin starting first.
In each turn they can slice a piece of cake from any rectangular cake. That
is, they choose a cake, make a cut parallel to one of the sides of the cake
and split the cake into two, then take one of the pieces. Or they can also eat
the whole cake.
Note that the cutpoint must be along a grid line (i.e. x=x0 or y=y0 for some integer x0/y0).
The one that take the last bit of all cakes win.
They are all very competitive, so they all make optimal decisions.
Who will win?
The testcase contains an integer T in the first line, indicating the number of testcases.
Each testcase contains an integer N in the first line, indicating the number of cakes initially. Then follows N pairs of integers (Li, Wi) being the length and width of the N cakes.
1 <= T <= 500
1 <= N <= 100
1 <= Li, Wi <= 35000
For each testcase, output the winner's name: 'kelvin' or 'dreamoon'.
2 1 4 4 2 3 4 5 6
kelvin dreamoon
Migrated from old NTUJ.
kelvin
No. | Testdata Range | Score |
---|