#include <bits/stdc++.h>

using namespace std;

long long T, N, M, K, ostatak, minbanan;

int main () {
    cin >> T;
    while (T--) {
         minbanan = 0;
         cin >> N >> M >> K;
         ostatak = N % K;

         for(int i = 1; i <= ostatak; i++) {
             minbanan += (N/K+1)*(((1+N/K)+1)/2.00);
         }
         for(int i = 1; i <= K-ostatak; i++) {
             minbanan += (N/K)*((N/K+1)/2.00);
         }

         if (M >= minbanan) cout << "Tak" << endl;
         else cout << "Nie" << endl;
    }
return 0;
}