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
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)x.size()
#define cat(x) cerr << #x << " = " << x << endl
#define IOS cin.tie(0); ios_base::sync_with_stdio(0)
 
using ll = long long;
using namespace std;
 
int n, cnt[15];
string s;
 
int main() {
	cin >> n;
	while (n--) {
		cin >> s;
		int a = s[0] - '1';
		int b = s[1] - 'A';
		cnt[3 * a + b]++;
	}
	bool good = true;
	for (int i = 0; i < 12; ++i)
		good &= cnt[i] > 0;
	for (int i = 12; i < 15; ++i)
		good &= cnt[i] > 1;
	cout << (good ? "TAK" : "NIE");
	return 0;
}