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
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	string p, d, pn="", pp="", dn="", dp="";
	cin >> p;
	cin >> d;
	for (int a = 0; a < p.length(); a++) {
		if (a % 2 == 0) { pp += p[a]; }
		else { pn += p[a]; }
	}
	for (int a = 0; a < d.length(); a++) {
		if (a % 2 == 0) { dp += d[a]; }
		else { dn += d[a]; }
	}
	sort(pn.begin(),pn.end());
	sort(pp.begin(),pp.end());
	sort(dn.begin(),dn.end());
	sort(dp.begin(),dp.end());
	if (pn == dn && pp == dp) { cout << "TAK"; }
	else {
		cout << "NIE";
	}
}