#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int tt;
    cin >> tt;
    while(tt--) {
    	long long n, m, k;
    	cin >> n >> m >> k;
    	long long manji = k-(n%k), veci = n%k;
    	long long duzina_manji = n/k, duzina_veci = n/k+1;
    	long long rez = manji * duzina_manji * (duzina_manji + 1) / 2 + veci * duzina_veci * (duzina_veci + 1) / 2;
    	if(rez <= m) cout << "Tak\n";
    	else cout << "Nie\n";
    }
    return 0;
}