#include <bits/stdc++.h>

using namespace std;

#define lli long long
#define ld long double

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    scanf("%i",&t);
    lli n,m,k;


    ld x,y,minimum;
    lli ostalo;

    for (int i = 0; i < t; ++i) {
        scanf("%lli %lli %lli",&n,&m,&k);

        x= ((((ld)(n)/(ld)(k))-floor((ld)(n)/(ld)(k)))>0.5) ? ceil((ld)(n)/(ld)(k)) : floor((ld)(n)/(ld)(k));

        ostalo = n-(x*(k-2));

        if(k>1) {
            if ((ostalo % 2) == 0) {
                y = ceil(ostalo / 2.);
                minimum = (k - 2) * ((x * (x + 1)) / 2) + ((y * (y + 1)) / 2);
            } else {
                y = n - (x * (k - 1));
                minimum = (k - 1) * ((x * (x + 1)) / 2) + ((y * (y + 1)) / 2);
            }
        }
        else
            minimum=(x*(x+1))/2;

        if (minimum <= m)
            printf("Tak\n");
        else
            printf("Nie\n");
    }


    return 0;
}