1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <cstdio>
#include <vector>

#define REP(i,n) for(int i=0; i<(n); ++i)

typedef long long LL;
std::vector<LL> fib{0,1};
enum { n_max = 1100000000 };

int main()
{
  while(fib.back()<n_max)
    fib.push_back(fib.back()+fib[fib.size()-2]);
  int t; scanf("%d",&t); while(t--)
  {
    int a; scanf("%d",&a); bool ok = 0;
    REP(i,fib.size()) REP(j,fib.size()) if(fib[i]*fib[j]==a) ok = 1;
    puts(ok ? "TAK" : "NIE");
  }

  return 0;
}