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
41
42
43
44
45
46
47
48
 #include <iostream>
 using namespace std; 
 int lus();
 int main()
{
	 std::ios_base::sync_with_stdio(false);
	int t,n,w1,w2,h1,h2,a,b,c,d,z=0;
	cin>>t;
	while(t!=0)
	{
		cin>>n;
		cin>>w1>>w2>>h1>>h2;
		for(int i=0;i<n-1;++i)
		{
			z=0;
			cin>>a>>b>>c>>d;
			if(a<=w1&&b>=w2&&c<=h1&&d>=h2)
			{
			w1=a;
			w2=b;
			h1=c;
			h2=d;
			cout<<"elo";
			z=1;
			}
			else if(a>=w1&&b<=w2&&c>=h1&&d<=h2)
			{
			z=1;
			}
		}
		if(z==1)
		cout<<"TAK"<<endl;
		else
		cout<<"NIE"<<endl;
		
		
		
		
		--t;
	}
	
	
	
	
	
	
	return 0;
}