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
#include <bits/stdc++.h>
using namespace std;



int main() {
	int n;
	string a, b;
	cin >> n >> a >> b;
	string A[2], B[2];
	for (int i = 0; i < n; i += 2) {
		A[0] += a[i];
		B[0] += b[i];
	}
	for (int i = 1; i < n; i += 2) {
		A[1] += a[i];
		B[1] += b[i];
	}
	bool flag = true;
	for (int i = 0; i < 2; i++) {
		sort(A[i].begin(), A[i].end());
		sort(B[i].begin(), B[i].end());
		if (A[i] != B[i]) {
			flag = false;
		}
	}
	if (flag) {
		cout << "TAK\n";
	}
	else {
		cout << "NIE\n";
	}
}