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 + 5;

int n;
char S1[N], S2[N];
int ile[2][26];

int main()
{
	scanf("%d", &n);
	scanf("%s", &S1);
	scanf("%s", &S2);
	for (int i = 0; i < n; i++) {
		ile[i % 2][S1[i] - 'a']++;
		ile[i % 2][S2[i] - 'a']--;
	}
	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < 2; j++) {
			if (ile[j][i] != 0) {
				printf("NIE\n");
				return 0;
			}
		}
	}
	printf("TAK\n");
}