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>


#define ll long long
using namespace std;

int n;

static vector<int> alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

map<char, int> x1;
map<char, int> o1;
map<char, int> x2;
map<char, int> o2;

string first, second;

int main(){
	scanf("%d\n",&n);
	for(auto& a:alphabet){
		x1[a] = 0;
		o1[a] = 0;
		x2[a] = 0;
		o2[a] = 0;
	}

	getline(cin, first);
	getline(cin, second);
	for(int i = 0; i<n; i++){
		if((i+1)%2 == 1){
			x1[first[i]] += 1;
			x2[second[i]] += 1;
		}
		else{
			o1[first[i]] += 1;
			o2[second[i]] += 1;
		}
	}

	for(auto& a : alphabet){
		if((x1[a]!=x2[a])or(o1[a]!=o2[a])){
			printf("NIE");
			return 0;
		}
//		printf("%c: %d %d %d %d\n",a,x1[a],o1[a],x2[a],o2[a]);
	}
	printf("TAK");

}