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
40
41
42
43
44
45
46
47
48
49
50
#include <bits/stdc++.h>

using namespace std;

#define pii pair<int, int>
#define FOR(x, j) for(int x = 0; x < j; x++)
#define ll long long

const int INF = 2e9;
const int maxN = 1e6+10;

void solve(){
    int n; cin >> n;
    string s1, s2;
    cin >> s1 >> s2;
    int A[100][2], B[100][2];
    for(int j = 0; j < 2; j++)
        for(int i = 0; i < 100; i++)
            A[i][j] = 0, B[i][j] = 0;
    for(int i = 0; i < n; i++){
        A[s1[i]-'a'][i%2]++;
        B[s2[i]-'a'][i%2]++;
    }
    for(int j = 0; j < 2; j++)
    for(int i = 0; i < 100; i++){
        if(A[i][j] != B[i][j]){
            cout << "NIE\n";
            return;
        }
    }
    cout << "TAK\n";



}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    bool multitest = false;
    //multitest = true;
    if (multitest) {
        int t; cin >> t;
        while (t--)
            solve();
    }
    else
        solve();
}