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
#include <iostream>
#include<sstream>
#define ll long long
using namespace std;

int get(int exl, int n){
for(int i=0;i<3;i++){
    if(i==exl)continue;
    if(n==0)return i;
    n--;
}
return 25;
}


ll count(int len) {
    if(len==0)return 1;
    return 1 + 2*count(len-1);
}

void doit(ll n, ll k) {

    ll next = count(n-1);
    k--;
    if(3*next<=k) {
        cout <<"NIE\n";
        return ;
    }

    int curr;
    stringstream ss;
    curr = k/next;
    ss<<(char)('a'+curr);
    k%=next;
    while(k>0) {
        n--;
        k--;
        next = count(n-1);
        int ncur = k / next;
        ncur = get(curr, ncur);
        ss <<(char)('a'+ncur);
        curr = ncur;
        k%=next;
    }


    cout << ss.str()<<"\n";

}

int main() {
    int n;ll k;
    cin >> n >>k;
    doit(n,k);
    return 0;
}