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
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
int cnt[100];
inline bool solve(string s1,string s2,int t)
{
	for(unsigned i=t;i<s1.size();i+=2)
		cnt[s1[i]-'a']++;
	for(unsigned i=t;i<s2.size();i+=2)
	{
		cnt[s2[i]-'a']--;
		if(cnt[s2[i]-'a']<0)
			return false;
	}
	return true;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	string s1,s2;
	cin>>n;
	cin>>s1>>s2;
	if(solve(s1,s2,0)&&solve(s1,s2,1))
		cout<<"TAK\n";
	else
		cout<<"NIE\n";
	return 0;
}