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

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    string vrednosti[n];
    long long uc, kb, gr, provera;
    for(int i = 0; i < n; i++)
    {
        cin >> uc >> kb >> gr;
        long long brgr2 = uc%gr, brgr1 = gr - brgr2, brucgr1 = uc/gr, brucgr2 = brucgr1 + 1;
        provera = kb -(brgr1*((brucgr1+1)*brucgr1)/2)-(brgr2*((brucgr2+1)*brucgr2)/2);
        if(provera >= 0) vrednosti[i] = "Tak";
        else vrednosti[i] = "Nie";
    }
    for(int i = 0; i < n;i++)
        cout << vrednosti[i] << "\n";
}