#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n; cin >> n;
    long long rez = 0;

    for(long long i = 0; i < n; i ++)
    {
        long long bruc; cin >> bruc;
        long long m; cin >> m;
        long long k; cin >> k;

        long long zbir = 0;
        long long rez = ceil(double(bruc)/double(k));
        long long rez1 = bruc/k;

        if(rez % 2 == 0)
            zbir = (rez/2)*(rez+1);
        else
            zbir = rez*((rez+1)/2);

        long long ostatak;
        ostatak = bruc - rez*rez1;

        long long zbir2=0;
        if(ostatak%2==0)
            zbir2 = (ostatak/2)*(ostatak-1);
        else
            zbir2 = ostatak*((ostatak-1)/2);

        if((zbir*rez1 + zbir2) > m)
            cout << "Nie" << endl;
        else
            cout << "Tak" << endl;

    }
    return 0;
}