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

pair<string,string> compress(const string& s){
	string a,b;
	for(int i=0;i<s.length();i++)
		(i&1 ? a : b) += s[i];

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());

	return {a,b};
}

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int n;
	cin >> n;

	string a,b;
	cin >> a >> b;

	cout << (compress(a) == compress(b) ? "TAK" : "NIE") << "\n";

	return 0;
}