#include <stdio.h>
#include <stdlib.h>

int f(int n)
{
    if(n==1) return 1;
    return f(n-1) + n;
}

int main()
{
    int t;
    scanf("%d", &t);

    long n[t], k[t];
    long long m[t];

    for(int i = 0; i < t; i++) {
        scanf("%ld %lld %ld", &n[i], &m[i], &k[i]);
    }

    for(int i = 0; i < t; i++) {
        if(i > 0) printf("\n");

        if(m[i] < n[i]) {
            printf("Nie");
            continue;
        }

        if(n[i] == k[i]) {
            printf("Tak");
            continue;
        }

        if((f(n[i] / k[i]) * (k[i] - (n[i] % k[i])) + f((n[i] / k[i]) + 1) * (n[i] % k[i])) <= m[i])
            printf("Tak");
        else
            printf("Nie");
    }

    return 0;
}