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
#include <iostream>
#include <string>
using namespace std;

int T[26], T2[26];

bool porownaj();

int main() {
	string a, b; 
	int n; cin>>n>>a>>b;
	for (int i=0; i<n; ++i) {
		T[a[i]-'a']++;
		T2[b[i]-'a']++;
		
	}
	if(porownaj()) cout<<"TAK";
	else cout<<"NIE";
}

bool porownaj() {
	for (int i=0; i<26; ++i) {
		if (T[i] != T2[i]) return false;
	}
	return true;
}