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
// Karol Kosinski 2020
#include <cstdio>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
using namespace std;

const int NX = 30'00'05;
const int AX = 27;

int T[2][AX];
char S1[NX], S2[NX];

int main()
{
    int n;
    scanf("%d%s%s", &n, S1, S2);
    FOR(i,0,n)
    {
        ++ T[ i % 2 ][ S1[i] - 'a' ];
        -- T[ i % 2 ][ S2[i] - 'a' ];
    }
    FOR(i,0,2) FOR(j,0,AX) if (T[i][j] != 0)
    {
        printf("NIE\n");
        return 0;
    }
    printf("TAK\n");
    return 0;
}