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
//  Wybor zadan
//  Sebastian Mroz

#include<bits/stdc++.h>
#define ll long long
#define pp pair<int, int>
#define ff first
#define ss second
#define pb push_back
using namespace std;

map<string, int> M;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n;
	string S;
	cin >> n;
	for(int i = 1; i <= n; ++i)
		cin >> S, ++M[S];
		
	if(M.size() != 15){cout << "NIE\n"; return 0;}
	if(M["5A"] == 1){cout << "NIE\n"; return 0;}
	if(M["5B"] == 1){cout << "NIE\n"; return 0;}
	if(M["5C"] == 1){cout << "NIE\n"; return 0;}
	
	cout << "TAK\n";
	
	return 0;
}