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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
#include <cmath>

using namespace std;

string pomysly[101];


int main(){

	string zadaniaSeria1[] = {"1A","1B","1C", "2A", "2B", "2C", "3A", "3B", "3C", "4A", "4B", "4C"};
	string zadaniaSeria2[] = {"5A", "5B", "5C"};
	int n;
	cin >>n;

	for(int i=0;i<n;i++) {
		cin >> pomysly[i];
		//cout << pomysly[i];
	}

	for(int i=0;i<12;i++) {
		for(int j=0;j<n;j++) {
			if (pomysly[j] == zadaniaSeria1[i]) {
				break;
			}
			else {
				if (j==n-1) {
					cout << "NIE";
					return 0;
				}
			}
			
		}
	}

	for(int i=0;i<3;i++) {
		int dwarazy=2;
		for(int j=0;j<n;j++) {
			if (pomysly[j] == zadaniaSeria2[i]) {
				dwarazy--;
			if (dwarazy<=0)	break;

			}
			else {
				if (j==n-1) {
					cout << "NIE";
					return 0;
				}
			}
			
			
		}
	}
	cout << "TAK";
	return 0;






}