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 <iostream>

#define ZAB_MAX 26

using namespace std;

int main()
{
	int zab_par[ZAB_MAX];
	int zab_npar[ZAB_MAX];
	char *zab;
	int n;
	for (int i=0;i<ZAB_MAX;++i)
	{
		zab_par[i]=0;
		zab_npar[i]=0;
	}
	cin >> n;
	zab = new char[n+1];
	cin >> zab;
	for (int i=0;i<n;++i)
	{
		if (i%2) zab_npar[zab[i]-'a']++;
		else zab_par[zab[i]-'a']++;
	}
	cin >> zab;
	for (int i=0;i<n;++i)
	{
		if (i%2) zab_npar[zab[i]-'a']--;
		else zab_par[zab[i]-'a']--;
	}
	for (int i=0;i<ZAB_MAX;++i)
	{
		if (zab_par[i] || zab_npar[i])
		{
			cout << "NIE" << endl;
			return 0;
		}
	}
	cout << "TAK" << endl;
	return 0;
}