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


using namespace std;
int tab1[26];
int tab2[26];

int main() {
    //ios::sync_with_stdio(false);
	int n;
	string s;
	cin >> n;
	char c;
	c=getchar();
	getline(std::cin,s);
	for(int i=0; i<n; i++){
        if(i%2 == 0)
            tab1[int(s[i]-97)]++;
        else
            tab2[int(s[i]-97)]++;
	}
	getline(std::cin,s);
	for(int i=0; i<n; i++){
	   if(i%2 == 0)
            tab1[int(s[i]-97)]--;
        else
            tab2[int(s[i]-97)]--;
	}
	string result = "TAK";
	for(int i=0; i<26; i++){
        if(tab1[i] != 0 || tab2[i] != 0){result="NIE";break;}
	}
	cout << result;
}