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
#include <iostream>
#include <vector>
#include <set>

using namespace std;

#define ULL unsigned long long

vector <ULL> fib;
set <ULL> ilo;

int main()
{
    ios_base::sync_with_stdio(0);

    ULL a = 1, b = 1;

    while(a < 1000000000)
    {
        fib.push_back(a);
        swap(a, b+=a);
    }

    for(int i=0; i<fib.size(); i++)
        for(int j=0; j<fib.size(); j++)
            ilo.insert(fib[i]*fib[j]);

    int t;
    cin >> t;

    while(t--)
    {
        ULL n;
        cin >> n;

        if(ilo.find(n) != ilo.end())
            cout << "TAK\n";
        else
            cout << "NIE\n";
    }

    return 0;
}