1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <string>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, i, nr;
    string s;
    int B[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    cin >> n;
    for (i = 0; i < n; i++)
    {
        cin >> s;
        B[(s[0]-'1') * 3 + (s[1]-'A')]++;
    }
    if ((B[0] > 0) && (B[1] > 0) && (B[2] > 0) && (B[3] > 0) && (B[4] > 0) && (B[5] > 0) && (B[6] > 0) && (B[7] > 0) && (B[8] > 0) && (B[9] > 0) && (B[10] > 0) && (B[11] > 0) && (B[12] > 1) && (B[13] > 1) && (B[14] > 1))
        cout << "TAK";
    else
        cout << "NIE";
    return 0;
}