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
#include <bits/stdc++.h>
using namespace std;

int n;
int cntA[2][26], cntB[2][26];
string A, B;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> A >> B;
	
	for (int i = 0; i < n; i++)
	{
		cntA[i%2][A[i]-'a']++;
		cntB[i%2][B[i]-'a']++;
	}
	
	for (int i = 0; i < 26; i++)
		if (cntA[0][i] != cntB[0][i] || cntA[1][i] != cntB[1][i])
		{
			cout << "NIE\n";
			return 0;
		}
	cout << "TAK\n";
}