#include <bits/stdc++.h>

using namespace std;

bool pakuj(int n, int m, int k)
{
    int s = 0, ost = n%k, br;
    for(int i = 0; i < k; i++)
    {
        if(ost)
        {
            br = n/k+1;
            ost--;
        }
        else
            br = n/k;
        s += br*(br+1)/2;
        if(s > m)
            return false;
    }
    return true;
}

int main()
{
    int t;
    cin >> t;
    int n[t], m[t], k[t];
    for(int i = 0; i < t; i++)
        cin >> n[i] >> m[i] >> k[i];
    for(int i = 0; i < t; i++)
        if(pakuj(n[i], m[i], k[i]))
            cout << "Tak" << endl;
        else
            cout << "Nie" << endl;
    return 0;
}