#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>

#define ll long long

using namespace::std;

void solve() {
    ll n, m, k;
    cin >> n >> m >> k;
    ll a1 = n % k;
    ll a2 = k - a1;
    ll b1 = n / k;
    ll b2 = b1 + 1;
    b1 = a2*b1*(b1 + 1) / 2;
    b2 = a1*b2*(b2 + 1) / 2;
    if(m - b2 >= b1){
        cout << "Tak" << endl;
    }
    else{
        cout << "Nie" << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int t; cin >> t;
    while(t--) solve();
    return 0;
}