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
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cstring>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define VI vector<int>
#define PII pair<int,int>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define lint long long int

#define max_n 100005

using namespace std;

VI F;

int main(){
	int a=0,b=1;
	F.pb(a); F.pb(b);
	while(b<=1e9){
		b = a+b;
		a = b-a;
		F.pb(b);
	}

	int z; scanf("%d",&z);
	while(z--){
		int n; scanf("%d",&n);
		bool flaga = false;
		FOR(i,1,F.size()){
			if(n%F[i]==0){
				int x = *lower_bound(F.begin(),F.end(),n/F[i]);
				if(x*F[i]==n) { flaga = true; break;}
			}
		}
		if(flaga) printf("TAK\n");
		else printf("NIE\n");
	}


	return 0;
}