#include <iostream>  
using namespace std;
long long Zbir(long long x)
{ 
    long long sum = ((x + 1) * x) / 2 ;
    return sum;
}
int main()
{
  
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T;
    cin >> T;
    long long N , M , K;
    for(int i = 0; i < T; i++)
    { 
        cin >> N >> M >> K;
        long long NumberOfGrupMembers = N / K , NumberOfGrupMembers2 = N % K;
        long long AmaountOf = Zbir(NumberOfGrupMembers);
        M = M - (AmaountOf * K);
        M = M - NumberOfGrupMembers2 * (NumberOfGrupMembers + 1);
        if(M < 0)
            cout << "Nie" << endl;
        else 
            cout << "Tak" << endl;
    }
    
    
    return 0;
}