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
#include <iostream>
#include <algorithm>
using namespace std;

string a, b, a1, a2, b1, b2;

int main(){
	ios::sync_with_stdio(0);
	int n;
	cin>>n>>a>>b;
	for(int i=0; i<n; i++){
		if(i&1){
			a1.push_back(a[i]);
			b1.push_back(b[i]);
		}
		else{
			a2.push_back(a[i]);
			b2.push_back(b[i]);
		}
	}
	sort(a1.begin(), a1.end());
	sort(b1.begin(), b1.end());
	sort(a2.begin(), a2.end());
	sort(b2.begin(), b2.end());
	
	if(a1 == b1 && a2 == b2)
		cout<<"TAK\n";
	else
		cout<<"NIE\n";
	
	return 0;
}