#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
using namespace std;
ll mod = (1 ? 1e9 + 7 : 998244353);
const int N = 5e5 + 5;
ll F(ll n) {
    return n * (n + 1) / 2;
}
void Evlos(){
    ll n, m, k;
    cin >> n >> m >> k;
    ll a = n / k;
    ll b = n % k;
    ll ans = F(a) * (k - b) + F(a + 1) * b;
    if (ans <= m) cout << "Tak" << en;
    else cout << "Nie" << en;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);
    int tt = 1;
    cin >> tt;
    while (tt--) Evlos();
    return 0;
}