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
#include <bits/stdc++.h>

using namespace std;

const int N = 3e5 + 7;

int n;
char in[N];
int cnt[2][N];

void solve (int v) {
	scanf("%s", in + 1);
	for (int i = 1; i <= n; ++i)
		cnt[i & 1][in[i]] += v;
}

int main () {
	scanf("%d", &n);
	solve(1);
	solve(-1);
	
	bool ok = true;
	for (int i = 'a'; i <= 'z'; ++i)
		ok &= abs(cnt[0][i]) + abs(cnt[1][i]) == 0;
	
	puts(ok ? "TAK" : "NIE");
	return 0;
}