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

int main()
{
	int n;
	char** lines = new char*[2];
	std::cin >> n;
	lines[0] = new char[n];
	lines[1] = new char[n];
	std::cin >> lines[0]>>lines[1];
	int toys[26][2];
	for(int i=0;i<26;i++)
	{
		toys[i][0] = 0;
		toys[i][1] = 0;
	}
	for(int i=0;i<n;i+=2)
	{
		toys[lines[0][i] - 97][0]++;
		toys[lines[1][i] - 97][0]--;		
	}
	for (int i = 1; i < n; i +=2)
	{
		toys[lines[0][i] - 97][1]++;
		toys[lines[1][i] - 97][1]--;
	}
	for(int i=0;i<26;i++)
	{
		if (toys[i][0] != 0 || toys[i][1] != 0)
		{
			std::cout << "NIE";
			return 0;
		}
	}
	std::cout << "TAK";
	return 0;
}