#include <iostream>

using namespace std;

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

    return 0;
}