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

int p1[26];
int p2[26];

int n1[26];
int n2[26];


int main(){
	bool wynik = true;
	int n, c;
	string a, b;
	
	cin >> n;
	cin >> a >> b;
	
	for(int i = 0; i<n; i+=2){
		c = a[i] - 97;
		p1[c]++;
		c = b[i] - 97;
		p2[c]++;
	}

	for(int i = 1; i<n; i+=2){
		c = a[i] - 97;
		n1[c]++;
		c = b[i] - 97;
		n2[c]++;	
	}	
	
	for(int i = 0; i<26; ++i){
		if(p1[i]!=p2[i]){
			wynik = false;
		}
		if(n1[i]!=n2[i]){
			wynik = false;
		}	
	}
	
	if(wynik){
		cout << "TAK";
	}else{
		cout << "NIE";
	}
	
	return 0;
}