#include <iostream>
#include <vector>

using namespace std;

string f(int n, int m, int k){
    int x = n/k;
    int y = n%k;
    int vise = y*int((x+2)*((x+1)/2.0));
    int manje = (k-y)*int((x+1)*(x/2.0));
    if (vise+manje < m){
        return ("Tak");
    }else{
        return ("Nie");
    }
}

int main()
{
    vector<string> a;
    int t;
    cin>>t;
    for (int i=0;i<t;i++){
        int n,m,k;
        scanf("%d%d%d",&n,&m,&k);
        a.push_back(f(n,m,k));
    }
    for (vector<string>::iterator it=a.begin();it!=a.end();it++){
        cout<<*it<<endl;
    }
}