1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <bits/stdc++.h>
using namespace std;

int n;
string s;
unordered_map<string, int> was;

int main(){
   ios_base::sync_with_stdio(0);
   cin.tie(NULL); cout.tie(NULL);
   cin >> n;
   for(int i=0; i<n; i++){
       cin >> s;
       was[s]++;
   }
   if(was["1A"]>=1 && was["1B"]>=1 && was["1C"]>=1 && was["2A"]>=1 && was["2B"]>=1 && was["2C"]>=1 && was["3A"]>=1 && was["3B"]>=1 && was["3C"]>=1 && was["4A"]>=1 && was["4B"]>=1 && was["4C"]>=1 && was["5A"]>=2 && was["5B"]>=2 && was["5C"]>=2){
       cout << "TAK";
   } else {
       cout << "NIE";
   }
}