#include <bits/stdc++.h>
using namespace std;
long long t,n,m,k,br,zadnja,ostatak,zbir;
int main(){
    scanf("%lld", &t);
    while(t--){
        br=0;
        zadnja=0;
        ostatak=0;
        zbir=0;

        scanf("%lld %lld %lld", &n, &m, &k);
        br=(n/k);
        ostatak=(n-(br*k));
        zbir=((ostatak*(((br+1)*(br+2))/2))+((k-ostatak)*((br*(br+1))/2)));

        if(zbir<=m)cout<<"Tak"<<endl;
        else       cout<<"Nie"<<endl;
    }



return 0;}