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
//Author: Piotr Zielinski
#include <bits/stdc++.h>

using namespace std;

pair<int, int> m[256][2];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    string s1, s2;
    cin >> n >> s1 >> s2;
    for(int i = 0;i < n;++i) {
        m[s1[i]][i&1].first++;
        m[s2[i]][i&1].second++;
    }
    for(int i = 'a';i <= 'z';++i)
        if(m[i][0].first != m[i][0].second || m[i][1].first != m[i][1].second) {
            cout << "NIE\n";
            return 0;
        }

    cout << "TAK\n";
    return 0;
}