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
var
a: array[0..100] of longint;
i,j,k,l,n: longint;
res: boolean;
function fib(value: longint):boolean;
var ii: longint;
begin
  fib := false;
  for ii:=1 to k do
    if value <= a[ii] then
    begin
      fib := value = a[ii];
      break;
    end;
end;
begin
a[1]:=1;k:=1;
repeat
k+=1;
a[k]:=a[k-1]+a[k-2];
until a[k]>1000000000;
read(n);
repeat
read(l);res:=false;j:=Round(sqrt(l));
for i:=2 to k-1 do
begin
  if a[i]>j then break;
  if (l mod a[i] = 0) and fib(l div a[i]) then
  begin
    res := true;
    break;
  end;
end;
if res then writeln('TAK') else writeln('NIE');
n-=1;until n=0;
end.