Under construction

Still being built. Things may change

Pretty Cake

Time limit1sMemory limit1024 MB

Summary
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. NN 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.

  1. The cake is a rectangular box with height 11 and volume NN.
  2. You must be able to cut the cake into NN cube-shaped pieces, each with side length 11.
  3. You must be able to wrap a band, made by joining rectangles of width 11 side by side, around the side of the cake with no gaps.
  4. The decorative band must show red, green, and white rectangles of width 11, in that order and repeating, with the same number of each color.

For example, the figure below shows one pretty cake for N=8N = 8 and the band used with it.

Pretty cake figure

Cake band example

Depending on the value of NN, a pretty cake may not be possible. Determine whether a pretty cake with volume NN can be made for each of Jongseo's friends.

Input

The first line contains an integer TT, the number of test cases.

Each of the next TT lines contains one integer NN, as defined in the problem.

Output

Print TT lines, one answer per line.

Print TAK if a pretty cake with volume NN can be made, and NIE otherwise.

Constraints

  • 1≤T≤1 0001 \le T \le 1\,000
  • 1≤N≤10181 \le N \le 10^{18}
  • All numbers in the input are integers.

Examples1

  1. Example 1

    Input
    3
    2
    9
    10
    
    Expected output
    TAK
    TAK
    NIE