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
#include <cmath>
#include <stdio.h>

unsigned long long int fibonacci(int n){
	return (1/sqrt(5))*(pow((1+sqrt(5))/2,n))-(1/sqrt(5))*(pow((1-sqrt(5))/2,n));
}

int main(){
	int t, n;
	scanf("%d", &t);
	for (int i = 0; i < t; i++){
		scanf("%ld", &n);
		bool found = false;
		for (int i = 1; i <= n && !found; i++){
			for (int j = 1; j <= n && !found; j++){
				if (n == fibonacci(i)*fibonacci(j))
					found = true;
			}
		}
		if (found)
			printf("TAK\n");
		else
			printf("NIE\n");
	}
}