Pretty Cake
Time limit1sMemory limit1024 MB
For each N, decide whether the base can be an a by b rectangle with a times b equal to N and a plus b divisible by 3.
- Level
Medium4 of 10
- Topics
- Math, Number theory
- Solved
- No attempts yet
Problem
Today, December 31, is Jongseo's birthday, and Good Bye 2021! opens today. friends want to make a pretty cake as a birthday present for Jongseo.
Here, a pretty cake is a cake that satisfies the following conditions.
- The cake is a rectangular box with height and volume .
- You must be able to cut the cake into cube-shaped pieces, each with side length .
- You must be able to wrap a band, made by joining rectangles of width side by side, around the side of the cake with no gaps.
- The decorative band must show red, green, and white rectangles of width , in that order and repeating, with the same number of each color.
For example, the figure below shows one pretty cake for and the band used with it.


Depending on the value of , a pretty cake may not be possible. Determine whether a pretty cake with volume can be made for each of Jongseo's friends.
Input
The first line contains an integer , the number of test cases.
Each of the next lines contains one integer , as defined in the problem.
Output
Print lines, one answer per line.
Print TAK if a pretty cake with volume can be made, and NIE otherwise.
Constraints
- All numbers in the input are integers.