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
#include <cstdio>

int ap[26], an[26], bp[26], bn[26];

int main() {
	int n;
	scanf("%d", &n);
	char a[300001], b[300001];
	scanf("%s", a);
	scanf("%s", b);
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			ap[a[i] - 'a']++;
			bp[b[i] - 'a']++;
		} else {
			an[a[i] - 'a']++;
			bn[b[i] - 'a']++;
		}
	}
	bool s = true;
	for (int i = 0; i < 26; i++) {
		if (ap[i] != bp[i] || an[i] != bn[i]) {
			s = false;
			break;
		}
	}
	if (s) {
		printf("TAK\n");
	} else {
		printf("NIE\n");
	}
	return 0;
}