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
36
37
38
39
40
41
42
43
#include <bits/stdc++.h>

#define FOR(i, b, e) for (int i = (b); i <= (e); i++)
#define FORD(i, b, e) for (int i = (e); i >= (b); i--)
#define MP make_pair
#define FS first
#define ND second
#define PB push_back
#define ALL(x) x.begin(), x.end()

using namespace std;

using LL = long long;
using PII = pair<int,int>;
using PLL = pair<LL,LL>;
using VI = vector<int>;
using VLL = vector<LL>;

template<class T>
int sz(const T& a) { return (int)a.size(); }
template<class T>
void amin(T& a, T b) { a = min(a, b); }
template<class T>
void amax(T& a, T b) { a = max(a, b); }

const int inf = 1e9;
const LL infl = 1e18;

int n, a[6][3];
char s[3];
bool ans = true;

int main()
{
  scanf("%d", &n);
  FOR(i, 1, n) {
    scanf("%s", &s[0]);
    a[s[0] - '0'][s[1] - 'A']++;
  }
  FOR(i, 1, 5) FOR(j, 0, 2) ans &= (a[i][j] >= 1);
  FOR(j, 0, 2) ans &= (a[5][j] >= 2);
  puts(ans ? "TAK" : "NIE");
}