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
35
36
37
38
39
40
#include<iostream>
using namespace std;
int main()
{
	std::ios_base::sync_with_stdio(0);
	int a;
	cin>>a;
	for(int i=0;i<a;i++)
	{
		int b;
		cin>>b;
			int w1,w2,h1,h2;
			cin>>w1>>w2>>h1>>h2;
			int ww,wh;
			ww=w2-w1;
			wh=h2-h1;
			int c=0;
		for(int j=1;j<b;j++)
		{
			cin>>w1>>w2>>h1>>h2;
			int ww2,wh2;
			ww2=w2-w1;
			wh2=h2-h1;
			
			if(ww<=ww2 && wh<=wh2)
			{
				ww=ww2;  wh=wh2;
				c=1;
			}
			

		}
		if(c==1)
		cout<<"TAK"<<endl;
		else
		cout<<"NIE"<<endl;
	}

	return 0;
}