/// *** Naglowki autorstwa Piotra Stanczyka

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <ctime>
#include <fstream>
#include <set>

#define FOR(x, b, e) for(int x = b; x <= (e); ++x)
#define FORD(x, b, e) for(int x = b; x >= (e); – –x)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define VAR(v, n) typeof(n) v = (n)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())
#define FOREACH(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define PB push_back
#define ST first
#define ND second

using namespace std;

const int size = 2000;
vector <long long int> F(size);//, Q(1000000000);
int quantity;

struct Pair
{
    long long int nr;
    bool pr;
};

struct cmp
{
    // czy a jest mniejsze od b
    bool operator() (const Pair &a, const Pair &b)
    {
        if (a.nr <= b.nr) return true;
        if (a.nr > b.nr) return false;
        //return a.pr<b.pr;
    }
};
set <Pair, cmp> product;

/*struct cmp2
{
    // czy a jest mniejsze od b
    bool operator() (const int &a, const int &b)
    {
        if (a <= b) return true;
        if (a > b) return false;
        //return a.pr<b.pr;
    }
};
set <int, cmp2> product2;*/

set <long long int> product3;

void createFibonacci(long long int n)
{
    //product.clear();
    //Pair temp;
    //temp.pr = true;

    //product3.clear();

    if(n > 0)
    {
        F[0] = 0;
        F[1] = 1;

        quantity = 1;

        FOR(i, 2, n)
        {
            if(F[i-2]+F[i-1] > n)break;
            F[i] = F[i-2]+F[i-1];

            quantity++;
        }
    }

    else
    {
        F[0] = 0;
        quantity = 0;
    }
}

vector <long long int> prod(size);

void products(long long int q, long long int n)
{
    /*Pair temp, temp2;
    //set<Pair>::iterator it;
    temp.pr = false;

    product.clear();

    FOR(i, 0, n)
    {
        temp.nr = i;
        product.insert(temp);
    }

    temp2.pr = true;*/

    product3.clear();
    prod.clear();

    FOR(i, 0, q)FOR(j, 0, q)
    {
        /*temp.nr = F[i]*F[j];
        temp2.nr = F[i]*F[j];

        product.erase(product.find(temp));
        product.insert(temp);*/

        product3.insert(F[i]*F[j]);
        prod.PB(F[i]*F[j]);
    }
}

int main()
{
    ios_base::sync_with_stdio(0);

    createFibonacci(1000000000);
    products(quantity, 1000000000);

    //FOR(i, 0, prod.size()-1)cout<<i<<": "<<prod[i]<<endl;

    set<Pair>::iterator it;
    set <long long int>::iterator it3;
    Pair temp;

    //FOR(i, 0, quantity)cout<<"F["<<i<<"] = "<<F[i]<<endl;

    long long int t, n;
    bool check;

    cin>>t;

    REP(x, t)
    {
        cin>>n;

        //createFibonacci(n);

        //FOR(i, 0, quantity)

        //temp.nr = n;
        //temp.pr = true;
        //it = product.find(temp);

        //if(it->pr)cout<<"TAK\n";
        //else cout<<"NIE\n";

        //it3 = product3.find(n);

        //cout<<*it3<<endl;
        /*if(*it3 == 0)cout<<"NIE\n";
        else cout<<"TAK\n";(*/

        check = false;
        FOREACH(i, prod)if(*i == n)
        {
            check = true;
            break;
        }

        if(check)cout<<"TAK\n";
        else cout<<"NIE\n";
    }

    return 0;
}

