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
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <set>
#include <cstring>
#include <list>
#include <iostream>
using namespace std;
#define FOR(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i <= n; i++)
#define FORI(it,n)for(typeof(n.begin()) it = n.begin(); it != n.end(); it++)
#define frs first
#define sec second
#define psh push_back
#define mkp make_pair
typedef long long LL;
typedef long double LD;

const int INF = 2147483647;
const int MAX = 1100100100;

vector<int> F;

int main() {
	F.push_back(0);
	F.push_back(1);
	while(F.back() < MAX) F.push_back(F[F.size() - 1] + F[F.size() - 2]);
	int n, a, b;
	bool bol;
	scanf("%d", &n);
	while(n--) {
		scanf("%d", &a);
		bol = false;
		for(auto it = ++F.begin(); it != F.end(); it++) {
			b = a / *it;
			if(b * (*it) != a) continue;
			auto p = lower_bound(F.begin(), F.end(), b);
			if((*p) * (*it) == a) {
				bol = true;
				break;
			}
		}
		if(bol) printf("TAK\n");
		else printf("NIE\n");
	}
}