#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O2")

// Loops
#define FOR(n)              for(int i=0;i<n;i++)
#define FORJ(n)             for(int j=0;j<n;j++)
#define FORN(n,x)           for(int x=0;i<n;i++)
#define RFOR(n)             for(int i=n-1;i>=0;i--)
#define RFORJ(n)            for(int j=n-1;j>=0;j--)
#define RFORN(n,x)          for(int x=n-1;x>=0;x--)
#define ODD_FOR(n)          for(int i=1;i<n;i+=2)
#define EVEN_FOR(n)         for(int i=0;i<n;i+=2)
#define FROM(n,m)           for(int i=n;i<m;i++)
#define FROMJ(n,m)          for(int j=n;j<m;j++)
#define FROMN(n,m,x)        for(int x=n;x<m;x++)
#define RFROM(n,m)          for(int i=n-1;i>=m;i--)
#define RFROMJ(n,m)         for(int j=n-1;j>=m;j--)
#define INVERT_FOR(n)       for(int i=0,j=n-1;i<n-1 && j>0;i++,j--)
#define STL_FOR(a)          for(auto i=a.begin();i!=a.end();i++)
#define STL_FORJ(a)         for(auto j=a.begin();j!=a.end();j++)
#define STL_FORN(a,x)       for(auto x=a.begin();x!=a.end();x++)
#define STL_FROM(a,n,m)     for(auto i=n;i!=m;i++)
#define STL_FROMJ(n,m)      for(auto j=n;j!=m;j++)
#define STL_RFOR(a)         for(auto i=a.rbegin();i!=a.rend();i++)
#define STL_RFORJ(a)        for(auto j=a.rbegin();j!=a.rend();j++)
#define popcnt(n)         __builtin_popcount(n)

// Input/ Output
#define read(n) cin>>n
#define write(n) cout<<n<<'\n'
#define FAST_IO()\
ios_base::sync_with_stdio(0);\
cin.tie(0); cout.tie(0)

//Types
#define ll                 long long 
#define vec                   vector
#define veci             vector<int>
#define vi               vector<int>
#define li                 list<int>
#define arri                arr<int>
#define mati                mat<int>
#define pb                 push_back
#define pf                push_front
#define ppb                 pop_back
#define ppf                pop_front
#define umap           unordered_map
#define ummap     unordered_multimap
#define mmap                multimap
#define mset                multiset
#define uset           unordered_set
#define umset     unordered_multiset
#define INT(n)          ((int)n-'0')
#define CHAR(n)            ((char)n)
#define sqr(n)             ((n)*(n))

//Template classes
template<typename t_mat>
class mat
{
    size_t row_size, col_size;
    t_mat* buff;
public:
    mat()=default;
    mat(size_t row_size, size_t col_size) { this->row_size=row_size; this->col_size=col_size; buff=new t_mat[row_size*col_size];FOR(row_size*col_size)buff[i]=0;}
    ~mat() { delete[] buff; }
    inline size_t size()        const {return row_size * col_size;}
    inline size_t rowsize() const {return row_size;}
    inline size_t colsize() const {return col_size;}
    inline t_mat* operator [](int row_index) {return &buff[row_index * col_size];}
    inline const t_mat* operator [](int col_index) const {return *buff[col_index * col_size];}
    friend istream& operator>> (istream& input, mat& self) { FOR(self.size()) { input>>self.buff[i];} return input; }
    friend ostream& operator<< (ostream& output,mat& self) { FOR(self.row_size){ FORJ(self.col_size) { output<<self[i][j]<<' '; }output<<'\n'; } return output;}

    bool operator==(mat& m)
    {
        FOR(row_size){
            FORJ(col_size)
            {
                if(buff[i*col_size+j]!=m[i][j])
                    return 0;
            }
        }

        return 1;
    }
};

template<typename t_arr>
class arr
{
    size_t arrsize;
    t_arr* buff;
public:
    int sum;
    arr()=default;
    arr(size_t arrsize) { this->arrsize=arrsize; buff=new t_arr[arrsize]; }
    ~arr() { delete[] buff; }
    inline size_t size() { return arrsize; }
    inline t_arr& operator[] (size_t index) const { return buff[index]; }
    friend istream& operator>> (istream& input,arr& self) { self.sum=0;FOR(self.size()) { input>>self[i];self.sum+=self[i];}return input; }
    friend ostream& operator<< (ostream& output,arr& self) { FOR(self.size()) { output<<self[i]<<'\n'; } return output;}
};



//----------------------------------------------------------------------------------------------------------------------------------

struct wedge
{
    int edge;
    int weight;
};

class graph
{
    size_t nodecount, edgecount;
    list<int>* adj;


public:
    graph(size_t nodecount, size_t edgecount)
    {
        this->nodecount=nodecount;
        this->edgecount=edgecount;

        adj= new list<int>[nodecount+1];
    }
    ~graph()
    {
        delete[] adj;
    }
    
    inline void insert(int node, int edge)
    {
        adj[node].pb(edge);
        adj[edge].pb(node);
    }

    friend istream& operator>> (istream& input, graph& self)
    {
        int node, edge;
        FOR(self.edgecount)
        {
            input >> node >> edge;
            self.insert(node, edge);
        }

        return input;
    }

    arr<int> bfs(int& s);
    void dfs();
};


const char* result()
{
    ll n,m,k;
    cin>>n>>m>>k;


    ll x=n/k;
    ll y=x+n%k;
    ll tmp= (k-1) * x*(x+1)/2 +y*(y+1)/2;

    if(n<k || tmp>m)
        return "Nie";

    return "Tak";
}

int main()
{
    FAST_IO();
    int t;
    cin>>t;
    arr<const char*> r(t);
    
    FOR(t)
        r[i]=result();
    cout<<r<<endl;
}