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>
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)x.size()
#define cat(x) cerr << #x << " = " << x << endl
#define IOS cin.tie(0); ios_base::sync_with_stdio(0)
 
using ll = long long;
using namespace std;

int n, cnt[2][2][26];
string s;
 
int main() {
	cin >> n;
	for (int i = 0; i < 2; ++i) {
		cin >> s;
		for (int j = 0; j < n; ++j)
			cnt[i][j & 1][s[j] - 'a']++;
	}
	for (int i = 0; i < 26; ++i)
		for (int j = 0; j < 2; ++j)
			if (cnt[0][j][i] != cnt[1][j][i])
				return cout << "NIE\n", 0;
	cout << "TAK\n";
	return 0;
}