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
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    
    vector <int> li(n);
    for(int i = 0; i < n; i++) {
	int a;
	cin>>li[i];
    }
    int mn = *max_element(li.begin(),li.end());
    vector <bool> ok(mn,0);
    int l1 = 0, l2 = 1;
    ok[0] = 1;
    ok[1] = 1;
    vector <int> fib;
    fib.push_back(0);
    for(int i = 1; i <= mn; i=l1+l2) {
	fib.push_back(i);
	ok[i] = 1;
	l1 = l2;
	l2 = i;
    }
    for(int i = 0; i < n; i++) {
	bool okey = false;
	for(int j = 1; j < int(fib.size()); j++) {
 	    if(li[i]%fib[j] == 0 && ok[li[i]/fib[j]] == 1) {
		okey = true;
		break;
	    }
	}
	string res;
	res = (okey) ? "TAK" : "NIE";
	cout<<res<<endl;
    }
}