#include <bits/stdc++.h>

using namespace std;

int main(){
    int t; cin>>t;
    int tpom=t;
    while(t>0){
        t--;
        int n,m,k; cin>>n>>m>>k;
        int g=n/k;
        int x=k*(g+1)-n;
        int bp=x*(g+1)*g/2+(k-x)*(g+2)*(g+1)/2;
        if(bp<=m) cout<<"Tak\n";
        else cout<<"Nie\n";
    }
    return 0;
}