#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        long long n, m, k;
        cin >> n >> m >> k;
        long long br = n / k;
        long long ost = n % k;
        long long res = (k - ost)*br*(br+1)/2 + ost*(br+1)*(br+2)/2;
        //cout << "res: " << res << endl;
        if(res <= m) cout << "Tak" << endl;
        else cout << "Nie" << endl;
    }


    return 0;
}