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 cnt1[2][26];
int cnt2[2][26];

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i){
		char c;
		cin >> c;
		cnt1[i%2][c-'a']++;
	}
	for (int i = 1; i <= n; ++i){
		char c;
		cin >> c;
		cnt2[i%2][c-'a']++;
	}

	bool same = true;
	for (int i = 0; i < 26; ++i)
		if (cnt1[0][i] != cnt2[0][i] || cnt1[1][i] != cnt2[1][i])
			same = false;
	
	cout << (same ? "TAK\n" : "NIE\n");
}