#include <iostream>
#include <vector>

using namespace std;



int main()
{
    int t;
    cin >> t;
    for(int i=0;i<t;i++)
    {
        int n,m,k;
        cin >> n >> m >> k;
        int x = n/k, y = n%k;
        int s=((x+1)*(x*(k-y)+(x+2)*y))/2;
        if(s<=m) cout << "Tak";
        else cout << "Nie";
    }
    return 0;
}