1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include<bits/stdc++.h>
using namespace std;

vector<int> fib({1, 1});

int main(int argc, char *argv[]) {
	while(fib.back() < 1000000000)
		fib.push_back(fib.back() + fib[fib.size()-2]);
	int z;
	scanf("%d", &z);
	while(z--)
	{
		int a;
		scanf("%d", &a);
		bool res = !a;
		for(int i : fib)
			res |= a % i == 0 && binary_search(fib.begin(), fib.end(), a/i);
		printf("%s\n", res ? "TAK" : "NIE");
	}
	return 0;
}