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
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string sa, sa1, sa2, sb, sb1, sb2;
int n;
int main()
{
    cin >> n;
    cin >> sa;
    cin >> sb;
    for (int i=0; i<n; i++)
    {
        if (i%2==0)
        {
            sa1.push_back(sa[i]);
            sb1.push_back(sb[i]);
        }
        else if (i%2==1)
        {
            sa2.push_back(sa[i]);
            sb2.push_back(sb[i]);
        }
    }
    sort(sa1.begin(), sa1.end());
    sort(sa2.begin(), sa2.end());
    sort(sb1.begin(), sb1.end());
    sort(sb2.begin(), sb2.end());
    if ((sa1==sb1)&&(sa2==sb2))
        cout << "TAK";
    else
        cout << "NIE";
    return 0;
}