#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t, n, k;
    cin >> t;
    long long m;
    char* a = "Tak";
    char* b = "Nie";
    string s = "";
    for (int i = 0; i < t; i++)
    {
        cin >> n >> m >> k;
        if (m >= ((n * (n + 1)) / 2) || m > ((n * (n + 1)) / 2) - k)
        {
            s += a;
            s += "\n";
        }
        else
        {
            s += b;
            s += "\n";
        }
    }
    cout << s;
    return 0;
}