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

char c;
int t[2][28], n;
int main()
{
    scanf("%d", &n);
    scanf(" %c", &c);
    t[0][c-'a']++;
    for(int i = 1; i < n; ++i)
    {
        scanf("%c" ,&c);
        t[i%2][c-'a']++;
    }
    scanf(" %c", &c);
    t[0][c-'a']--;
    for(int i = 1; i < n; ++i)
    {
        scanf("%c" ,&c);
        t[i%2][c-'a']--;
    }
    for(int i = 0; i < 26; ++i)
    {
      //  cout<<char(i+'a')<<endl;;
        if(t[0][i] != 0 || t[1][i] != 0)
        {
            printf("NIE");
            return 0;
        }
    }
    printf("TAK");
}