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
#include <bits/stdc++.h>
using namespace std;

int toys[28][2];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    bool result=true;
    cin >> n;
    string a,b;
    cin >> a >> b;
    for(int i=0;i<n;i++){
        toys[a[i]-'a'][i%2]++;
        toys[b[i]-'a'][i%2]--;
    }
    for(int i=0;i<26;i++){
        if(toys[i][0]!=0 || toys[i][1]!=0)result=false;
    }

    if(result==true)cout << "TAK\n";
    else cout << "NIE\n";

    return 0;
}