1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <bits/stdc++.h>
using namespace std;

int zl[2]['z'+1][2];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	string s[2];
	cin >> n >> s[0] >> s[1];
	for (int j: {0, 1})
		for (int i=0; i<n; i++) {
			zl[j][s[j][i]][i%2]++;
		}
	for (int i=0; i<='z'; i++) {
		if (zl[0][i][0] != zl[1][i][0] || zl[0][i][1] != zl[1][i][1]) {
			cout << "NIE";
			return 0;
		}
	}
	cout << "TAK";
}