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
50
51
52
53
54
#include <iostream>
#include <string>
using namespace std;
void check(int n){
	int i = 0;
	bool a[26] = {0};
	bool b[26] = {0};
	bool pa[26] = {0};
	bool na[26] = {0};
	bool pb[26] = {0};
	bool nb[26] = {0};
	string x;
	cin >> x;
	for(int j = 0; j < x.length(); j++){
		a[x[j]-97] = true;
		if(j%2 == 0)
			pa[x[j]-97] = true;
		else
			na[x[j]-97] = true;
	}
	cin >> x;
	for(int j = 0; j < x.length(); j++){
		b[x[j]-97] = true;
		if(j%2 == 0)
			pb[x[j]-97] = true;
		else
			nb[x[j]-97] = true;
	}
	for(int i = 0; i < 26; i++){
		if(a[i] != b[i]){
			cout << "NIE";
			return;
		}
	}
	for(int i = 0; i < 26; i++){
		if(pa[i] != pb[i]){
			cout << "NIE";
			return;
		}
	}
	for(int i = 0; i < 26; i++){
		if(na[i] != nb[i]){
			cout << "NIE";
			return;
		}
	}
	cout << "TAK";
}

int main(){
	int n;
	cin >> n;
	check(n);
}