#include <bits/stdc++.h>
using namespace std;

long long tschokolade_po_grupu(long long n)
{
    long long p = 0;
    if (n % 2) p = n / 2 + 1;
    return (p + (n / 2) * (n + 1));
}

// n - utschenici; m - bananice; k - grupe;
bool ekskurzija(long long n, long long m, long long k)
{
    if (k > n) return false;
    long long jg = n % k; long long sg = k - jg;

    /*
    cout << "ima " << sg << " grupe s " << (n / k) << " dyaka,\n";
    cout << "a " << jg << " grupe sas " << (n / k + 1) << " dyaka.\n";
    */

    long long brb = sg * tschokolade_po_grupu(n / k) + jg * tschokolade_po_grupu(n / k + 1);
    if (brb > m) return false;
    return true;
}

int main()
{
    long long t; cin >> t;

    for (long long i = 0; i < t; i++) {
        long long n, m, k; cin >> n >> m >> k;
        if (ekskurzija(n, m, k)) cout << "Tak\n";
        else cout << "Nie\n";
    }
}