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

using namespace std;

int main() {
	ios_base::sync_with_stdio(0);

	int N;
	cin >> N;

	typedef vector<char> V;
	V z[2][2];
	for (int i = 0; i < 2; i++)
		for (int j = 0; j < 2; j++)
			z[i][j].reserve(N);

	for (int k = 0; k < 2; k++) {
		for (int i = 0; i < N; i++) {
			char c;
			cin >> c;
			z[k][i%2].push_back(c);
		}
	}
	
	for (int i = 0; i < 2; i++)
		for (int j = 0; j < 2; j++)
			sort(z[i][j].begin(), z[i][j].end());

	if (z[0][0] == z[1][0] && z[0][1] == z[1][1])
		cout << "TAK\n";
	else
		cout << "NIE\n";

	return 0;
}