#include <iostream>

using namespace std;

int main()
{
    int t;
    cin >> t;
    string *a = new string[t];
    for(int i = 0; i < t; i++){
        int n, k;
        long long m;
        cin >> n >> m >> k;
        int b = n/k;
        int s = n%k;
        long long p = b*(b + 1)/2 + s*(b + 1);
        if(p <= m) a[i] = "Tak";
        else a[i] = "Nie";
    }
    for(int i = 0; i < t; i++){
        cout << a[i] << endl;
    }
    delete[] a;
    return 0;
}