#include <bits/stdc++.h>

#define IOS {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}

using namespace std;

int t, n, k;
long long m;
string s[15];

void solve()
{
    cin >> t ;

    int br = 0 ;
    while(br < t)
    {
        cin >> n >> m >> k ;

        int a = n/k ;
        long long tmp = k*a*(a+1)/2 ;
        int b = n - k*a ;
        tmp += b*(a+1) ;
        if(tmp > m)s[br] = "Nie" ;
        else s[br] = "Tak" ;
        br++ ;
    }

    for(int i = 0 ; i < t ; i++)
    {
        cout << s[i] << endl ;
    }
}

int main()
{
    IOS ;

    solve() ;
}