#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
  
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int T;

    cin >> T;

    while(T--){

        long long n, m, k;

        cin >> n >> m >> k;

        long long cnt = 0, x = n/k;
        cnt += k*(x*(x+1)/2);
        n -= x*k;

        cnt += (x+1)*n;

        if(cnt <= m) cout << "Tak";
        else cout << "Nie";
        cout << '\n';
    }
    return 0;
}