#include <iostream>

using namespace std;

long long zbir(long long n){
    if(n == 1) return 1;
    long long r = (n+1) * n / 2;
    if(n % 2 == 0) return r;
    return (r + (n/2) + 1);


}

int main()
{
   long long n, m, k, s = 0;
   int t;
   cin >> t;
   while(t--){
        cin >> n >> m >> k;
        s = (n % k) * zbir(n/k + 1) + (k - (n % k)) * zbir(n/k);
        if(s <= m)
            cout << "Tak\n";
        else
            cout << "Nie\n";
   }
    return 0;
}