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
45
46
47
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int MAX_N = 1000000000;
int main()
{
    vector<int> F = {1,2};
    while( F.back() < MAX_N )
    {
        int pp, p;
        p = F.back();
        pp = *(F.rbegin() + 1);
        F.push_back( p + pp );
    }
    int t = 0;
    cin >> t;
    for ( int i = 0; i < t; ++i )
    {
        int in;
        bool find = false;
        cin >> in;

        if ( in <= 5 ) find = true;
        else
        {
            for ( int x: F )
            {
                if ( x <= in )
                {
                    if ( !(in % x) )
                    {
                        int d = in / x;
                        find = binary_search( F.begin(), F.end(), d );
                        if ( find ) break;
                    }
                }
                else break;
            }
        }
        if ( find ) cout << "TAK" << endl;
        else cout << "NIE" << endl;
    }
    return 0;
}