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
#include <bits/stdc++.h>
#define ll long long
#define sz(x) x.size()

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
    ll n;
    cin >> n;
    string s1, s2;
    cin >> s1 >> s2;
    vector<ll> v1(26);
    vector<ll> v2(26);
    vector<ll> v3(26);
    vector<ll> v4(26);
    for(int i = 0; i < n; i += 2) {
        v1[s1[i] - 'a']++;
        v2[s2[i] - 'a']++;
    }
    for(int i = 1; i < n; i += 2) {
        v3[s1[i] - 'a']++;
        v4[s2[i] - 'a']++;
    }
    bool ans = 1;
    for(int i = 0; i < 26; i++) {
        if(v1[i] != v2[i]) ans = 0;
        if(v3[i] != v4[i]) ans = 0;
    }
    if(ans) cout << "TAK\n";
    else cout << "NIE\n";
}