#include <bits/stdc++.h>

#define f(n) for (int i = 0; i < n; i++)
#define f0(n) for (int j = 0; j < n; j++)
#define co(n) cout << n << "\n";

using namespace std;

int f1(int a)
{
    return (a * (a + 1)) / 2;
}

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

    int t;
    cin >> t;
    vector<bool> r(t);
    f(t)
    {
        int n, m, k, b;
        cin >> n >> m >> k;
        b = n / k;
        int x = k * f1(b) + (n - b * k) * (b + 1);
        if (x <= m) r[i] = true;
        else r[i] = false;
    }
    f(t)
    {
        if (r[i]) { co("Tak"); }
        else { co("Nie"); }
    }
}