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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
#include <set>
#include <iomanip>
#include <map>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

#define REP(i,n) for(int i = 0 ; i < (n) ; i++)
#define FOR(i,b,e) for(int i = (b) ; i <= (e) ; i++)
#define FORD(i,b,e) for(int i = (b) ; i >= (e) ; i--)
#define VAR(i,n) typeof(n) i = (n)
#define FOREACH(i,c)for(VAR(i,(c).begin());i!=(c).end();i++)
#define ALL(c) (c).begin(),(c).end()
#define SIZE(c) (int)(c).size()
#define PB push_back
#define st first
#define nd second

const int inf=1000000000;
const double pi=3.141592653589793;

typedef vector<int> VI;
typedef long long LL;
typedef long double LD;

VI fib;

int main()
{
    ios::sync_with_stdio(0);
    fib.resize(50);
    fib[0]=fib[1]=1;
    FOR(i,2,44)fib[i]=fib[i-1]+fib[i-2];
    int il=45;
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        bool czy=0;
        REP(i,il)
        {
            if(n%fib[i]==0)
            {
                REP(j,il)if(fib[j]==n/fib[i])
                {
                    czy=1;
                    break;
                }
            }
        }
        if(czy)cout << "TAK\n";
        else cout << "NIE\n";
    }
}