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
33
34
35
#include <bits/stdc++.h>

using namespace std;

map<string,int> req;

int main(){
  req["1A"] = req["1B"] = req["1C"] = \
  req["2A"] = req["2B"] = req["2C"] = \
  req["3A"] = req["3B"] = req["3C"] = \
  req["4A"] = req["4B"] = req["4C"] = 1;
  req["5A"] = req["5B"] = req["5C"] = 2;
  
  int n;
  cin>>n;
  string s;
  while(n--){
    cin>>s;
    req[s]--;
  }
  bool ok = true;
  for(pair<string,int> x : req){
    if(x.second > 0){
      ok = false;
    }
  }
  
  if(ok){
    cout<<"TAK"<<endl;
  }
  else {
    cout<<"NIE"<<endl;
  }
  
}