1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by szymon on 2014-05-08.
 */
public class ilo {
    static final int MAX = (int)Math.pow(10, 9);
    static ArrayList<Integer> fiboNumbers;
    static{
        fiboNumbers = new ArrayList<Integer>(); fiboNumbers.add(0); fiboNumbers.add(1);
        int next = fiboNumbers.get(0) + fiboNumbers.get(1);

        while(next<=MAX){
            fiboNumbers.add(next);
            next = fiboNumbers.get(fiboNumbers.size()-2) + fiboNumbers.get(fiboNumbers.size()-1);
        }
    }

    static boolean checkNumber(int n){
        for(int i : fiboNumbers){
            for(int j : fiboNumbers){
                if(i*j == n){
                    return true;
                }
            }
        }
        return false;
    }

    public static void main(String args[]){
        Scanner s = new Scanner(System.in);
        int testCases = s.nextInt();
        for(int i=0; i < testCases; i++){
            int number = s.nextInt();
            boolean result = ilo.checkNumber(number);
            System.out.println(result?"TAK":"NIE");
        }

    }



}