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
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

using LL = long long;
using ULL = unsigned long long;
using VB = vector<bool>;

ULL tree_size (int m){
  return (1ULL<<min(m+1, 62)) - 1;
}
map<char, vector<char>> trans = {
  {'a', {'b', 'c'}}, {'b', {'a', 'c'}}, {'c', {'a', 'b'}}};
int main(){
  int n; ULL k;
  cin >> n >> k;

  k--; n--;
  string res;
  for(int i = 0; i < 3; i++){
    if(k < (i + 1) * tree_size(n)){
      res.push_back('a' + i);
      break;
    }
  }
  if(res.empty()){
    cout << "NIE\n";
    return 0;
  }
  while(k > 0){
    k--; n--;
    if(k >= tree_size(n)) {
      k -= tree_size(n);
      res.push_back(trans[res.back()][1]);
    } else {
      res.push_back(trans[res.back()][0]);
    }
  }
  cout << res << "\n";
  return 0;
}