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
//  Zabawki
//  Sebastian Mroz

#include<bits/stdc++.h>
#define ll long long 
#define pp pair<int, int>
#define ff first
#define ss second
#define pb push_back
using namespace std;

map<char, int> MN1, MP1, MN2, MP2;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n;
	string S;
	cin >> n >> S;
	for(int i = 0; i < n; ++i){
		if((i + 1) % 2)
			++MN1[S[i]];
		else
			++MP1[S[i]];
	}
	cin >> S;
	for(int i = 0; i < n; ++i){
		if((i + 1) % 2)
			++MN2[S[i]];
		else
			++MP2[S[i]];
	}
	for(char a = 'a'; a <= 'z'; ++a){
		if(MN1[a] != MN2[a] || MP1[a] != MP2[a]){
			cout << "NIE\n";
			return 0;
		}
	}
	
	cout << "TAK\n";
	
	return 0;
}