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

#define sz(x) ((int)(x).size())
#define pb push_back
#define vec vector
#define fi first
#define se second
#define ends "\n"
#define sp ' '
#define fun function
#define ar(x) array<int, x>
#define rall(x) (x).rbegin(), (x).rend()
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const long long MOD=1e9+7; 

void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...); }
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)



int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr);
 	
    int q;
    cin >> q;
    while(q--){
        long long n, m, k;
        cin >> n >> m >> k;

        fun<long long()> binary_search = [&] (){
            long long lb = 0, rb = m;
            long long mxAns = lb;
            while(lb <= rb){
                long long mb = (lb + rb) / 2;
                if(mb <= (long long)(long long)((2LL * m) / k) / (mb + 1LL)){
                    mxAns = mb;
                    lb = mb + 1;
                }else
                    rb = mb - 1;
            }
            return mxAns;
        };

        long long f1 = (long long) n / k;
        long long f2 = binary_search();

        if(f1 > f2){
            cout << "Nie" << ends;
            continue;
        }

        long long f = min(f1, f2);
        long long restSum = m - (f * (f + 1) * k) / 2;
        long long restN = n - f * k;


        if(restN * (f + 1) <= restSum)
            cout << "Tak" << ends;
        else
            cout << "Nie" << ends;

    }
 	
}