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
/*	Arek Wróbel - skater
 *
 *	Zadanie: Iloczyn (liczb Fibonacciego)
 */
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define REP(I, N) for(int I=0; I<(N); ++I)
#define FOR(I, M, N) for(int I=(M); I<=(N); ++I)
#define FORD(I, M, N) for(int I=(M); I>=(N); --I)
#define FOREACH(IT, CON) for(__typeof(CON.begin()) IT=CON.begin(); IT!=CON.end(); ++IT)
#define ST first
#define ND second
#define MP make_pair
#define PB push_back
const int INF=1000000000;
const LL INFLL=1000000000000000000LL;

LL fib[1000000] = {0, 1};
int ilef=2;

bool check(int n) {
	REP(i, ilef)
		FOR(j, i, ilef-1)
			if ( fib[i] * fib[j] == n)
				return true;
	return false;
}

int main()
{
	for (ilef = 2; fib[ilef-1] <= INF; ++ilef)
		fib[ilef] = fib[ilef-1] + fib[ilef-2];
	--ilef;
	
	int t;
	scanf("%d", &t);
	while(t--) {
		int n;
		// wej
		scanf("%d", &n);
		// wyj
		printf(check(n) ? "TAK\n" : "NIE\n");
	}
	return 0;
}