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
43
44
45
46
#include <iostream>
#include <vector>
#include <string>

using namespace std;

auto constexpr SIZE = 26;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	char c;
	int size;
	cin >> size;

	vector<vector<int>> first(2, vector<int>(SIZE)), second(2, vector<int>(SIZE));

	for (int index = 0; index < size; index++)
	{
		cin >> c;
		first[index % 2][c - 'a']++;
	}

	for (int index = 0; index < size; index++)
	{
		cin >> c;
		second[index % 2][c - 'a']++;
	}

	for (int index = 0; index < 2; index++)
	{
		for (int letter = 0; letter < SIZE; letter++)
		{
			if (first[index][letter] != second[index][letter])
			{
				cout << "NIE";
				return 0;
			}
		}
	}

	cout << "TAK";
	return 0;
}