#include <bits/stdc++.h>

using namespace std;

int main(){
    int t;
    cin >> t;
    for(int q = 0; q < t; q++)
    {
        int n, m ,k;
        cin >> n >> m >> k;
        if(n%k==0)
            if(k*(n/k*(n/k+1)/2) <= m)
            cout << "Tak\n";
            else cout << "Nie\n";
        else
            if((n%k)*((n/k+2)*(n/k+1)/2)+(k-n%k)*(n/k*(n/k+1)/2) <= m)
            cout << "Tak\n";
        else cout << "Nie\n";
    }
}