1724 - Play Chess in Cafe
Time Limit : 10 Second
Memory Limit : 512 MB
Submission: 1
Solved: 1
- Description
Background:
According to the ancient history books, the ancient God Lalatina, with his teammates use_nature and DHL, participated in the CCPC in Jilin University one day in 2016. However, the time they reached the canteen, they were totally impressed by the new splendid building of Rixin building. Since then, Lalatina always claimed that canteens of HUST is the second of the best canteens he had ever went.
With a card which valued $150, they were able to play in the wonderful building. They hung out and finally found a café on the third floor. After they ordered their coffee, which cost almost two thirds of their card(hhhhhhhhhhhh), they accidently found a chess on the table. Therefore, Lalatina and use_nature started to play chess for amusement.
Description: Now we are in the café of that building in 2016.
The chessboard is an 8×8 board, but to simplify the problem they will use half of the board(4×8). There is exactly 6 pieces called king, queen, rook, bishop, knight and pawn.
Each chess piece has its own way of moving. In the diagrams, the dots mark the squares where the piece can move if there are no intervening piece(s) of either color.
· The king moves one square in any direction.
· The rook can move any number of squares along a rank or file, but cannot leap over other pieces.
· The bishop can move any number of squares diagonally, but cannot leap over other pieces.
· The queen combines the power of a rook and bishop and can move any number of squares along a rank, file, or diagonal, but cannot leap over other pieces.
· The knight moves to any of the closest squares that are not on the same rank, file, or diagonal, thus the move forms an "L"-shape: two squares vertically and one square horizontally, or two squares horizontally and one square vertically. The knight is the only piece that can leap over other pieces.
· The pawn can move forward to the unoccupied square immediately in front of it on the same file.
Now the question is simple. Lalatina will arbitrarily place these pieces on board. Then use_nature moves first. To avoid the game ending in a draw, piece must move forward, neither back nor left/right and no piece eat others. For example, king only has three directions. Thus, the one who cannot move a single step lose the game. Now use_nature has to determine if there is a strategy to win Lalatina.
Since Lalatina and use_nature both get tired of play a single game, they decided to play a huge chess: Which means they are going to play N chess games in the meantime. There is N chessboard and in each round, a player can move only one step in one board which he chooses. After lots of moves, the last one who cannot move a single step lose the game. Since Lalatina has a powerful brain, and use_nature thinks that he cannot win by pure luck. So he decided to ask for your help. please tell him whether he can win the game.
- Input
The first line contains a single integer T. The input contains T test cases.
In each case, the first line contains only one integer N, representing the number of chessboard. The chessboard is a 4×8 board.
The following 6 lines describe the coordinates (started from zero) of each piece by the following order.
The order: King, Queen, Rook, Bishop, Knight, Pawn.
- Output
For each case, output a single line. If use_nature can win, output “use_nature is lucky to win.”, otherwise output “Lalatina has a powerful brain.”
- sample input
-
2 1 0 0 0 1 0 2 0 3 0 4 0 5 2 3 0 3 1 3 2 3 3 2 4 3 5 3 0 3 1 3 2 3 3 3 4 2 5
- sample output
-
use_nature is lucky to win. Lalatina has a powerful brain.
- hint
- source
- liuxiaokui