#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    unsigned long long int m,x,b;
    int t,i,l;
    long int n,k;
    cin >> t;
    bool bul[t];
    for(i=0; i<t; i++)
    {
        b = 0;
        cin >> n >> m >> k;
        x = n/k;
        b += (x*(x+1)/2)*(k-(n%k));
        x = n/k+1;
        b += (x*(x+1)/2)*(n%k);
        if(m >= b) bul[i] = true;
        else bul[i] = false;

    }
    for(i=0; i<t-1; i++)
    {
        if(bul[i]) cout << "Tak" << "\n";
        else cout << "Nie" << "\n";
    }
    if(bul[i]) cout << "Tak";
    else cout << "Nie";
    return 0;
}