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


int rest(int num)
{
    return (num * (num + 1)) / 2;
}

int main()
{
    int testnum, s, k, g;
    scanf("%d",&testnum);

    for(int i = 0 ; i < testnum ; i++)
    {
        scanf("%d %d %d", &s, &k, &g);
        int groupsizes[g];
        memset( groupsizes, 0, g*sizeof(int) );


        int limit = 0;
        for(int j = 0 ; j < s ; j++)
        {

            groupsizes[limit]++;

            limit++;
            if(limit >= g)
                limit = 0;
        }

        int need = 0;
        for(int k = 0 ; k < g ; k++)
            need += rest(groupsizes[k]);

        if(need > k)
            printf("Nie");
        else
            printf("Tak");

    }

    return 0;
}