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 thicc(boi) boi.size()
#define magiczne ios_base::sync_with_stdio(0);
#define linijki cin.tie(NULL);

using namespace std;

int dx[6]['C' + 1];

int main()
{
    magiczne linijki;
    int n;
    string boi;
    cin >> n;
    for (int i = 0;i<n;i++)
    	{
    		cin >> boi;
    		dx[boi[0] - '0'][boi[1]]++;
    	}
    bool kk = true;
    for (int i = 1;i<5;i++)
    	for (char j = 'A';j<='C';j++)
    		if (dx[i][j] < 1)
				kk = false;
	int i = 5;
	for (char j = 'A';j<='C';j++)
		if (dx[i][j] < 2)
			kk = false;
	cout << (kk ? "TAK\n" : "NIE\n");
    return 0;
}