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
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define mp make_pair
#define fi first
#define se second
#define pii pair <int,int>
#define pli pair <ll,int>
#define pll pair <ll,ll>
#define ppi pair <pii,pii>
#define vi vector <int>
#define vl vector <ll>
#define uset unordered_set
#define umap unordered_map
#define INF (1<<30)
#define INF_LL (1ll<<60)
#define MAX 2000005
#define MAX_LVL 21

using namespace std;


template <typename T>
ostream & operator << (ostream &out, const vector <T> &V);

template <typename T>
ostream & operator << (ostream &out, const set <T> &S);

template <typename T>
ostream & operator << (ostream &out, const multiset <T> &S);

template <typename T1, typename T2>
ostream & operator << (ostream &out, const pair <T1, T2> &P);

template <typename T1, typename T2>
ostream & operator << (ostream &out, const map <T1, T2> &M);


void testcase() {
	int n;
	cin >> n;
	umap <string, int> C;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		C[s]++;
	}
	if (C.size() == 15 && C["5A"] >= 2 && C["5B"] >= 2 && C["5C"] >= 2) {
		cout << "TAK" <<endl;
	}
	else {
		cout << "NIE" <<endl;
	}
}

void init() {
    
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    init();
    int T = 1;
    //cin >> T;
    for (int t = 1; t <= T; t++) {
        testcase();
    }
    return 0;
}




template <typename T>
ostream & operator << (ostream &out, const vector <T> &V) {
	if (!V.empty()) {
		out << "{";
		for (auto v : V)
			out << v << ", ";
		out << "\b\b}";			// \b is backspace
	}
	else {
		out << "{}";
	}
	return out;
}

template <typename T>
ostream & operator << (ostream &out, const set <T> &S) {
	if (!S.empty()) {
		out << "set{";
		for (auto v : S)
			out << v << ", ";
		out << "\b\b}";			// \b is backspace
	}
	else {
		out << "{}";
	}
	return out;
}

template <typename T>
ostream & operator << (ostream &out, const multiset <T> &S) {
	if (!S.empty()) {
		out << "set{";
		for (auto v : S)
			out << v << ", ";
		out << "\b\b}";			// \b is backspace
	}
	else {
		out << "{}";
	}
	return out;
}

template <typename T1, typename T2>
ostream & operator << (ostream &out, const map <T1,T2> &M) {
	if (!M.empty()) {
		out << "map{";
		for (auto &kv : M)
			out << "(" << kv.fi << ": " << kv.se << ")" << ", ";
		out << "\b\b}";			// \b is backspace
	}
	else {
		out << "{}";
	}
	return out;
}

template <typename T1, typename T2>
ostream & operator << (ostream &out, const pair <T1, T2> &P) {
	out << "{" << P.first << ", " << P.second << "}";
	return out;
}