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
#include<bits/stdc++.h>
using namespace std;
#define magiczne ios_base::sync_with_stdio(0);
#define linijki cin.tie(0);
int zadanie[5][3], n;
string temp;
int main()
{
    magiczne linijki
    zadanie[4][0] = -1;
    zadanie[4][1] = -1;
    zadanie[4][2] = -1;
    for (cin >> n; n--;)
    {
        cin >> temp;
        zadanie[temp[0] - 49][temp[1] - 65]++;
    }
    for (int i = 0; i < 5; ++i)
        for (int j = 0; j < 3; ++j)
            if (zadanie[i][j] < 1)
            {
                cout << "NIE";
                return 0;
            }
    cout << "TAK";
    return 0;
}