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
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
    vector<char> a_1;
    vector<char> a_2;
    
    vector<char> b_1;
    vector<char> b_2;
    
    int t;
    
    cin >> t;
    
    string a;
    string b;
    
    cin >>a >> b;
    
    for (int i=0; i<t; i++){
        if(i%2 ==0){
            a_1.push_back(a[i]);
            b_1.push_back(b[i]);
        }else{
            a_2.push_back(a[i]);
            b_2.push_back(b[i]);
        }
    }
    
    sort(a_1.begin(), a_1.end()); 
    sort(a_2.begin(), a_2.end()); 
    sort(b_1.begin(), b_1.end()); 
    sort(b_2.begin(), b_2.end()); 
    
    bool f_1 = equal(a_1.begin(), a_1.end(), b_1.begin());
    bool f_2 = equal(a_2.begin(), a_2.end(), b_2.begin());
    
    if(f_1 && f_2){
        cout << "TAK";
    }else{
        cout << "NIE";
    }
}