#include <iostream>

using namespace std;
struct Ucenici {
    long long n;
    long long m;
    long long k;
};
long long sabiranje(long long x, long long y) {
    long long br=0,obr=0;
    long long omegalul=0;
    br = x / y;
    obr = x % y;
    for (long long i = 1; i <= br; i++)
    {
        omegalul += i;
    }
    omegalul = omegalul * y;
    for (long long i = 1; i <= obr; i++)
    {
        omegalul += i;
    }
    return omegalul;
}
int main()
{
    long long t;
    cin >> t;
    string b[10];
    Ucenici a[10];
    for (int i = 0; i < t; i++) {
        cin >> a[i].n >> a[i].m >> a[i].k;
        if (sabiranje(a[i].n, a[i].k) < a[i].m)
            b[i] = "Tak";
        else
            b[i] = "Nie";
    }
    for (int i = 0; i < t; i++)
        cout << b[i] << endl;
    
}