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
#include <iostream>
#include <stdio.h>
using namespace std;

int main() 
{
	int n;
	char s1[300300], s2[300300];
	
	int t1[300][2] = {0}, t2[300][2] = {0};
	int i,j;
	char c;
	
	scanf("%d", &n);
	scanf("%s", s1);
	scanf("%s", s2);
	
	for (i=0; i<n; i++) t1[s1[i]][i%2]++;
	for (i=0; i<n; i++) t2[s2[i]][i%2]++;
	
	//for (c='a'; c<='z'; c++) printf("c = %c, t1[0] = %d, t1[1] = %d, t2[0] = %d, t1[2] = %d\n", c, t1[c][0], t1[c][1], t2[c][0], t2[c][1]);
	
	for (c='a'; c<='z'; c++) if (t1[c][0] != t2[c][0] || t1[c][1] != t2[c][1]) {printf("NIE"); return 0;}
	
	printf("TAK");
	return 0;
}