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 <cstdio>

int ile,testy;
long long fib[100],x;
long long MAX_VAL = 1000000000LL;

int main() {
  fib[ile++] = 0;
  fib[ile++] = 1;  
  while (fib[ile-1] + fib[ile-2] <= MAX_VAL) {
    ++ile;
    fib[ile-1] = fib[ile-2] + fib[ile-3];
  }

  scanf("%d",&testy);
  while (testy--) {
    scanf("%lld",&x);
    bool mozna = false;
    for (int i = 0; i < ile; i++) 
      for (int j = 0; j < ile; j++)
        if (fib[i]*fib[j] == x) mozna = true;
    puts(mozna ? "TAK" : "NIE");
  }
  return 0;
}