#include <bits/stdc++.h>
using namespace std;

#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while(t--){
        ll n, m, k;
        cin >> n >> m >> k;
        ll height = n / k;
        ll base = height * (height + 1) * k / 2;
        if(base > m){
            cout << "Nie\n";
            continue;
        }
        n = n % k;
        m -= base;
        if(n * (height + 1) > m){
            cout << "Nie\n";
            continue;
        }

        cout << "Tak\n";
        continue;
    }
    return 0;
}