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
#include <iostream>

using namespace std;

int main() {
	int z; cin >> z;
	int tab[26][2];
	char l;
	int p = 0;
	for (int i = 0; i < 26; i++) { tab[i][0] = 0; tab[i][1] = 0; }
	for (int i = 0; i < z; i++) {
		cin >> l;
		tab[l - 'a'][p]++;
		p = 1 - p;
	}
	p = 0;
	for (int i = 0; i < z; i++) {
		cin >> l;
		tab[l - 'a'][p]--;
		p = 1 - p;
	}
	p = 0;
	for (int i = 0; i < 26; i++) if (tab[i][0] || tab[i][1]) { p = 1; break; }
	if (p) cout << "NIE"; else cout << "TAK";
	return 0;
}