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

int main() {
	int n;
	std::cin >> n;
	std::string start;
	std::cin >> start;
	std::string target;
	std::cin >> target;

	int count[26][2];
	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < 2; j++) {
			count[i][j] = 0;
		}
	}

	for (int i = 0; i < n; i++) {
		count[start[i] - 'a'][i&1]++;
		count[target[i] - 'a'][i&1]--;
	}

	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < 2; j++) {
			if (count[i][j] != 0) {
				std::cout << "NIE\n";
				return 0;
			}
		}
	}

	std::cout << "TAK\n";
	return 0;
}