1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <cstdio>
#include <iostream>
using namespace std;
const int INF=1000000000;
int main()
{
	int t,n,minw=INF,maxw=0,minh=INF,maxh=0,x,a,b,c,z;
	scanf("%d",&t);
	bool y=false;
	for (int i=0;i<t;i++)
	{
		scanf(" %d",&n);
		{
			y=false;
			for (int j=0;j<n;j++)
			{
				scanf(" %d %d %d %d",&a,&b,&c,&z);
				if (a<=minw && b>=maxw && c<=minh && z>=maxh )
				{
					y=true;
				}
					minw=a;
					maxw=b;
					minh=c;
					maxh=z;
				
			}
			if (y==true)
			printf("TAK\n");
			else printf("NIE\n");
		}
	}
	return 0;
}