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
#include <iostream>
#include <math.h>
using namespace std;

bool fib(int x){
    int a = 0, b = 1;
    while(b<x){
        int temp = b;
        b+=a;
        a = temp;
    }
    if(b==x) return true;
    else return false;
}
int main()
{
    ios_base::sync_with_stdio(0);
    int t;
    cin>>t;
    while(t--){
        long long a;
        cin>>a;
        bool ans = 0;
        if(a==0) ans = true;
        int f1 = 0, f2 = 1;
        while(f2<=sqrt(a) && !ans){
            long long x = a/f2;
            if(x*f2 == a)
                if(fib(x)) ans = 1;
            int temp = f2;
            f2 += f1;
            f1 = temp;
        }
        if(ans) cout<<"TAK"<<endl;
        else cout<<"NIE"<<endl;
    }
    return 0;
}