#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int t,n,k;
int bru,q=0;
long long m;
bool p;
int main () {
    cin>>t;
    for (int i=1;i<=t;i++) {
        cin>>n>>m>>k;
        bru=n/k;
        for (int j=1;j<=bru;j++) {
            q+=j;
            if (m==q*k ) {p=true;}
            else {p=false;}
        }
        if (p==true) {cout<<"Tak"<<endl;}
        else {cout<<"Nie"<<endl;}
    }
    return 0;
}