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
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include <iostream>
using namespace std;
int n,t[26][2],q[26][3],x;
string b1, b2;
int main()
{
    cin>>n;
    cin>>b1>>b2;
    for(int i=0;i<n;i++)
    {
        if(i%2==0)
        {
            if(b1[i]=='a') t[0][0]++;
            if(b1[i]=='b') t[1][0]++;
            if(b1[i]=='c') t[2][0]++;
            if(b1[i]=='d') t[3][0]++;
            if(b1[i]=='e') t[4][0]++;
            if(b1[i]=='f') t[5][0]++;
            if(b1[i]=='g') t[6][0]++;
            if(b1[i]=='h') t[7][0]++;
            if(b1[i]=='i') t[8][0]++;
            if(b1[i]=='j') t[9][0]++;
            if(b1[i]=='k') t[10][0]++;
            if(b1[i]=='l') t[11][0]++;
            if(b1[i]=='m') t[12][0]++;
            if(b1[i]=='n') t[13][0]++;
            if(b1[i]=='o') t[14][0]++;
            if(b1[i]=='p') t[15][0]++;
            if(b1[i]=='q') t[16][0]++;
            if(b1[i]=='r') t[17][0]++;
            if(b1[i]=='s') t[18][0]++;
            if(b1[i]=='t') t[19][0]++;
            if(b1[i]=='u') t[20][0]++;
            if(b1[i]=='v') t[21][0]++;
            if(b1[i]=='w') t[22][0]++;
            if(b1[i]=='x') t[23][0]++;
            if(b1[i]=='y') t[24][0]++;
            if(b1[i]=='z') t[25][0]++;

        }
        else
        {

            if(b1[i]=='a') t[0][1]++;
            if(b1[i]=='b') t[1][1]++;
            if(b1[i]=='c') t[2][1]++;
            if(b1[i]=='d') t[3][1]++;
            if(b1[i]=='e') t[4][1]++;
            if(b1[i]=='f') t[5][1]++;
            if(b1[i]=='g') t[6][1]++;
            if(b1[i]=='h') t[7][1]++;
            if(b1[i]=='i') t[8][1]++;
            if(b1[i]=='j') t[9][1]++;
            if(b1[i]=='k') t[10][1]++;
            if(b1[i]=='l') t[11][1]++;
            if(b1[i]=='m') t[12][1]++;
            if(b1[i]=='n') t[13][1]++;
            if(b1[i]=='o') t[14][1]++;
            if(b1[i]=='p') t[15][1]++;
            if(b1[i]=='q') t[16][1]++;
            if(b1[i]=='r') t[17][1]++;
            if(b1[i]=='s') t[18][1]++;
            if(b1[i]=='t') t[19][1]++;
            if(b1[i]=='u') t[20][1]++;
            if(b1[i]=='v') t[21][1]++;
            if(b1[i]=='w') t[22][1]++;
            if(b1[i]=='x') t[23][1]++;
            if(b1[i]=='y') t[24][1]++;
            if(b1[i]=='z') t[25][1]++;
        }
    }
    for(int i=0;i<n;i++)
    {
        if(i%2==0)
        {
            if(b2[i]=='a') q[0][0]++;
            if(b2[i]=='b') q[1][0]++;
            if(b2[i]=='c') q[2][0]++;
            if(b2[i]=='d') q[3][0]++;
            if(b2[i]=='e') q[4][0]++;
            if(b2[i]=='f') q[5][0]++;
            if(b2[i]=='g') q[6][0]++;
            if(b2[i]=='h') q[7][0]++;
            if(b2[i]=='i') q[8][0]++;
            if(b2[i]=='j') q[9][0]++;
            if(b2[i]=='k') q[10][0]++;
            if(b2[i]=='l') q[11][0]++;
            if(b2[i]=='m') q[12][0]++;
            if(b2[i]=='n') q[13][0]++;
            if(b2[i]=='o') q[14][0]++;
            if(b2[i]=='p') q[15][0]++;
            if(b2[i]=='q') q[16][0]++;
            if(b2[i]=='r') q[17][0]++;
            if(b2[i]=='s') q[18][0]++;
            if(b2[i]=='t') q[19][0]++;
            if(b2[i]=='u') q[20][0]++;
            if(b2[i]=='v') q[21][0]++;
            if(b2[i]=='w') q[22][0]++;
            if(b2[i]=='x') q[23][0]++;
            if(b2[i]=='y') q[24][0]++;
            if(b2[i]=='z') q[25][0]++;

        }
        else
        {

            if(b2[i]=='a') q[0][1]++;
            if(b2[i]=='b') q[1][1]++;
            if(b2[i]=='c') q[2][1]++;
            if(b2[i]=='d') q[3][1]++;
            if(b2[i]=='e') q[4][1]++;
            if(b2[i]=='f') q[5][1]++;
            if(b2[i]=='g') q[6][1]++;
            if(b2[i]=='h') q[7][1]++;
            if(b2[i]=='i') q[8][1]++;
            if(b2[i]=='j') q[9][1]++;
            if(b2[i]=='k') q[10][1]++;
            if(b2[i]=='l') q[11][1]++;
            if(b2[i]=='m') q[12][1]++;
            if(b2[i]=='n') q[13][1]++;
            if(b2[i]=='o') q[14][1]++;
            if(b2[i]=='p') q[15][1]++;
            if(b2[i]=='q') q[16][1]++;
            if(b2[i]=='r') q[17][1]++;
            if(b2[i]=='s') q[18][1]++;
            if(b2[i]=='t') q[19][1]++;
            if(b2[i]=='u') q[20][1]++;
            if(b2[i]=='v') q[21][1]++;
            if(b2[i]=='w') q[22][1]++;
            if(b2[i]=='x') q[23][1]++;
            if(b2[i]=='y') q[24][1]++;
            if(b2[i]=='z') q[25][1]++;
        }
    }
    for(int i=0;i<26;i++)
    {
        if(t[i][0]==q[i][0]) x++;
        if(t[i][1]==q[i][1]) x++;
    }
    if(x==52) cout<<"TAK";
    else cout<<"NIE";
    return 0;
}