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

int main(void){
	
	int a = 1, n, x, y, z, s, n1[100], i1, i, p = 0;
	
	scanf("%d", &n);
	
	for(i = 0; i<n; i++){
		
		scanf("%d%d%d",&x, &y, &z);
		while(i1<x-1){
			a = a+1;
			s+=a;
			i1++;
		}
		if(y < s) p = -99;
			else if(x>1){
				if(z<2) p = -99;
			}
		n1[i] = p;
	}
	for(i = 0; i<n; i++){
		if(n1[i] >= 0) printf("Tak\n");
			else printf("Nie\n");
		
	}
	
	
	return 0;
}