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

using namespace std;

int n;
string s1,s2;
vector<char> v1,v2,v3,v4;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie();
    cout.tie();
    cin >> n;
    cin >> s1;
    cin >> s2;
    for (int i = 0; i < s1.size(); i++)
    {
       if(i%2==0)
       {
           v1.push_back(s1[i]);
           v2.push_back(s2[i]);
       }     
       else 
       {
           v3.push_back(s1[i]);
           v4.push_back(s2[i]);
       }
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    sort(v3.begin(),v3.end());
    sort(v4.begin(),v4.end());

    if(v1==v2 and v3==v4)
    cout<<"TAK";
    else 
    cout<<"NIE";
  
}