Pebbles

No attempts yetTime limit1sMemory limit128 MB

Problem

Bituś and Bajtuś are spending the holidays by the Byte Sea. Warm sand and tall waves interest them far less than a good puzzle, so they gathered a sizeable pile of round pebbles that the sea had washed ashore and started a new game.

The rules are simple. Bituś moves first. He must take at least one pebble, and he is not allowed to take the whole pile. After that the boys move alternately, starting with Bajtuś, and on each move a player may take at least one pebble, in an amount that was not taken on any earlier move. Taking everything that is left is allowed. In short, every move removes a different number of pebbles, and the amount Bituś took on the opening move already counts as used. A player who cannot take anything on their turn loses.

Given the number of pebbles at the start of the game, and assuming both boys play optimally, decide whether Bituś wins.

Input

The first line contains one integer tt (1t1061 \le t \le 10^6), the number of test cases.

Each of the next tt lines contains one integer nn (1n1091 \le n \le 10^9), the number of pebbles at the start of that game.

Output

Print exactly tt lines. The ii-th line holds the answer for the ii-th test case: TAK if Bituś wins the game, and NIE if he does not.