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

int ile1a[26], ile1b[26], ile2a[26], ile2b[26];

int main()
{
    int n;
    string s1, s2;
    cin >> n >> s1 >> s2;

    for(int i = 0; i < s1.length(); i++)
        if(i%2 == 0)
        {
            ile1a[s1[i]-'a']++;
            ile2a[s2[i]-'a']++;
        }
        else
        {
            ile1b[s1[i]-'a']++;
            ile2b[s2[i]-'a']++;
        }

    for(int i = 0; i < 26; i++)
    {
        if(ile1a[i] != ile2a[i])
        {
            //cout << ile1a[i] << " " << ile2a[i] << endl;
            cout << "NIE";
            return 0;
        }
        if(ile1b[i] != ile2b[i])
        {
            //cout << ile1b[i] << " " << ile2b[i] << endl;
            cout << "NIE";
            return 0;
        }
    }

    cout << "TAK";
    return 0;
}