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 <bits/stdc++.h>
using namespace std;
char c[100];
int t[1000111];
int main() {
  int n;
  scanf("%d", &n);
  int hash1 = '5'*1000+'A';
  int hash2 = '5'*1000+'B';
  int hash3 = '5'*1000+'C';
  for (int i = 1; i <= n; i++) {
    scanf("%s", c);
    int hash = c[0]*1000+c[1];
    t[hash]++;
  }
  int good = 0;
  for (int i = 1; i <= 100000; i++) {
    if (t[i] > 0) {
      if (i == hash1 || i == hash2 || i == hash3) {
        if (t[i] > 1) good+=2;
      }
      else good++;
    } 
  }

  if (good == 18) printf("TAK\n");
  else printf("NIE\n");


  return 0;
}