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
#include<iostream>
using namespace std;

int chars[26][2];

//g++ -O3 -static 2C/2C.cpp -std=c++11 -o 2C/2c

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0; i < s.length(); i++){
        chars[s[i] - 'a'][i%2] ++;
    }
    cin >> s;
    for(int i = 0; i < s.length(); i++){
        chars[s[i] - 'a'][i%2] --;
    }
    for(int i = 0; i < 26; i++){
        if(chars[i][0] != 0 || chars[i][1] != 0){
            cout << "NIE";
            return 0;
        }
    }
    cout << "TAK";
    return 0;
}