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
38
39
40
41
42
43
44
45
46
47
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
	int n; cin >> n;
	string a, b;
	cin >> a >> b;
	
	vector<char> an, ap, bn, bp;
	
	for(int i=0;i<n;i++)
	{
		if(i%2==0)
		{
			ap.push_back(a[i]);
			bp.push_back(b[i]);
		}
		else
		{
			an.push_back(a[i]);
			bn.push_back(b[i]);
		}		
		
	}
	sort(ap.begin(),ap.end());
	sort(bp.begin(),bp.end());
	sort(an.begin(),an.end());
	sort(bn.begin(),bn.end());
	
	bool czy = true;
	
	for(int i=0; i<ap.size();i++) 
		if(ap[i]!=bp[i])
			czy = false;

	for(int i=0; i<an.size();i++) 
		if(an[i]!=bn[i])
			czy = false;
	
	if(czy)	cout << "TAK";
	else cout << "NIE";
	
	return 0;
}