#include <bits/stdc++.h>

using namespace std;

int main()
{
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    for(int i = 0; i < t; i++)
    {
        int m, n, k;
        cin >> n >> m >> k;
        if(k == 1)
        {
            if(n * (n + 1) / 2 <= m) cout << "Tak\n";
            else cout<<"Nie\n";
        }
        else if(n==3)
        {
            if(k == 2)
            {
                if(m >= 4) cout << "Tak\n";
                else cout << "Nie\n";

            }
            if(k == 3)
            {
                if(m >= 3) cout << "Tak\n";
                else cout << "Nie\n";
            }
        }
    }
    return 0;
}