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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Lupus Nocawy 9 V 2014, PA2014
// http://potyczki.mimuw.edu.pl/
// Runda 0 Zadanie: Iloczyn

#include <cstdio>
#include <iostream>
#include <cassert>
#include <cstring>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define REP(i,n) for(int i=0, _n=n; i<_n; ++i)
#define FOR(i,a,b) for(int i=(a), _b=(b); i<=_b; ++i)
#define FORD(i,a,b) for(int i=(a), _b=(b); i>=_b; --i)
#define IT(i,x) __typeof__(x) i=x
#define FOREACH(it,x) for(__typeof__((x).begin()) it=(x).begin(); it!=(x).end(); ++it)
#define ALL(x) x.begin(),x.end()
#define MP make_pair
#define PB push_back
#define DEBUG(x) if(debug) cout << x << endl;
typedef long long int lli;
typedef unsigned long long int llu;
typedef pair<int,int> pii;
const int debug=0;

const int INF = 2147483647;
const int max_n = 1000000000;

vector<int> fib;
set<int> ilo;

void solve(void){
	int n;
	scanf("%d ", &n);
	if(ilo.count(n)!=0) printf("TAK\n");
	else printf("NIE\n");
	return;
}

int main(void){
	fib.PB(0);
	fib.PB(1);
	int l=1;
	while(fib[l]+fib[l-1] <= max_n){
		fib.PB(fib[l]+fib[l-1]);
		l++;
	}
	for(int i=2; i<=l; ++i){
		for(int j=i; j<=l; ++j){
			if( (lli)fib[i]*(lli)fib[j] <= (lli)max_n ){
				ilo.insert(fib[i]*fib[j]);
			}
			else{
				l = j;
			}
		}
	}
	int t;
	scanf("%d ", &t);
	while(t--)
		solve();
	return 0;
}