#include <bits/stdc++.h>
using namespace std;
long long t;
long long n,m,k;
long long d,x;
long long s,y;
int main() {
    cin >> t;
    while(t--) {
        cin >> n >> m >> k;


        s=n/k;
        y=n/k+1;
        d=n%k;
        x=k-n%k;
        m-=(s*(s+1)/2)*x;
        m-=((y*(y+1)/2))*d;
        if(m<0) cout << "Nie" << endl;
        else cout << "Tak" << endl;


    }


    return 0;
}