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
#include <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

using namespace std;

using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;

int n;
string a, b, c, d, s1, s2;

int main() {_
	cin >> n >> s1 >> s2;
	for(int i = 0; i < n; ++i) {
		if(i & 1) {
			a += s1[i];
			b += s2[i];
		} else {
			c += s1[i];
			d += s2[i];
		}
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	sort(d.begin(), d.end());
	if(a == b && c == d) {
		cout << "TAK";
	} else {
		cout << "NIE";
	}
	
	
}