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

int main(){
        ios::sync_with_stdio(0);
                cin.tie(0);

                        long T;
                                scanf("%ld", &T);

                                        string s[T];
                                                int j = 0;
                                                        long N, M, K;
                                                                long p = 0;
                                                                        long k = 0, o = 0;
                                                                                for(int i = 0;i < T;i++){
                                                                                                scanf("%ld %ld %ld", &N, &M, &K);

                                                                                                                k = N / K; o = N % K;

                                                                                                                                p = (k - o) * (k * (k + 1) / 2) + o * ((k + 1) * (k + 2) / 2);

                                                                                                                                                if(M < p){ s[j] = "Nei"; }
                                                                                                                                                                else{
                                                                                                                                                                                        s[j] = "Tak";
                                                                                                                                                                                                        }
                                                                                                                                                                                                                        j++;
                                                                                                                                                                                                                                }

                                                                                                                                                                                                                                        for(j = 0;j < T;j++){
                                                                                                                                                                                                                                                        cout << s[j] << '\n';
                                                                                                                                                                                                                                                                }

                                                                                                                                                                                                                                                                        return 0;
                                                                                                                                                                                                                                                                        }