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
#include <bits/stdc++.h>
#define qio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug(x) cerr<<#x<<" "<<x<<endl
#define ll long long 
#define st first
#define nd second
using namespace std;

int n, t, tab[10][10], temp;
string s;
int main()
{
	qio;
	cin >> n;

	for (int i = 1; i <= n; i++) {
		cin >> s;
		tab[s[1] - 'A' + 1][s[0] - '0']++;
	}

	for (int i = 1; i <= 3; i++) {
		for (int j = 1; j <= 5; j++) {
			if (j <= 4 && tab[i][j] >= 1) temp++;
			if (j == 5 && tab[i][j] >= 2) temp++;
		}
	}

	if (temp == 15) cout << "TAK";
	else cout << "NIE";


}