#include <iostream>
using namespace std;
typedef long long ll;
bool solve() {
    ll n, m, k;
    cin >> n >> m >> k;
    ll d = (n - k + k - 1) / k;
    ll a = n - d * k;
    ll b = k - a;
    return (d + 1) * (d + 2) / 2 * a + d * (d + 1) / 2 * b <= m;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t--) cout << (solve() ? "Tak" : "Nie") << endl;

    #ifdef CHUNGUS
    system("pause");
    #endif