#include <iostream>

using namespace std;

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