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
#include <cstdio>
using namespace std;

int n;
char s1[300002];
char s2[300002];

int pa1[26] = {0};
int np1[26] = {0};
int pa2[26] = {0};
int np2[26] = {0};


int main()
{
	scanf("%d\n", &n);
	scanf("%s", s1);
	scanf("%s", s2);

	for(int i=0;i<n;i++) {
		if (i % 2 == 0) {
			pa1[s1[i]-'a']++;
			pa2[s2[i]-'a']++;
		}
		else {
			np1[s1[i]-'a']++;
			np2[s2[i]-'a']++;
		}
	}

	for(int i=0;i<26;i++) {
		// printf("dla literki %c: w slowie pierwszym: %d p %d np, w slowie drugim: %d p %d np\n", i + 'a'
			// , pa1[i], np1[i], pa2[i], np2[i]);
		if (pa1[i] != pa2[i] || np1[i] != np2[i]) {
			printf("NIE\n");
			return 0;
		}
	}

	printf("TAK\n");
	return 0;
}