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
#include <stdio.h>
#include <strings.h>
#include <iostream>
#include <string>
#include <vector>
#include <bits/stdc++.h>
#include <tuple>
#include <cstdio>

using namespace std;


int main() {
    int n;
    scanf("%d\n", &n);
    map<string, int> zad2count;
    for (int i=0; i<n; ++i) {
        string s;
        cin>>s;
        zad2count[s]++;
    }
    
    bool ok=zad2count["1A"]>0 && zad2count["1B"]>0 && zad2count["1C"]>0 &&
            zad2count["2A"]>0 && zad2count["2B"]>0 && zad2count["2C"]>0 &&
            zad2count["3A"]>0 && zad2count["3B"]>0 && zad2count["3C"]>0 &&
            zad2count["4A"]>0 && zad2count["4B"]>0 && zad2count["4C"]>0 &&
            zad2count["5A"]>1 && zad2count["5B"]>1 && zad2count["5C"]>1;
    
    cout<<(ok?"TAK":"NIE")<<endl;
    return 0;
}