#include using namespace std; #define rep(i,n) for (int i = 0; i< (n); ++i) #define repi(i, a, b) for (int i = (a); i < (b); ++i) #define all(x) (x).begin(), (x).end() #define fore(i, a) for(auto &i:a) using ll = long long; int main() { int n;cin >> n; int s;cin >> s; vector three(n+2), two(n+2); three[0] = 1;two[0] = 1; rep(i, n+1){ three[i+1] = three[i]*3; two[i+1] = two[i]*2; } int rem = s; bool eA = false,eB = false, eC = false; string ans(n, '*'); vector clist ={'A','B','C'}; rep(i, n){ fore(c, clist){ int t = (eA || c == 'A')+(eB || c == 'B')+(eC || c == 'C'); int kouho; if(t == 1){ kouho = three[n-1-i]-two[n-i]+1; } else if(t == 2){ kouho = three[n-1-i]-two[n-1-i]; } else{ kouho = three[n-1-i]; } if(rem > kouho){ rem-=kouho; if(c == 'C'){ cout << -1 << endl; return 0; } } else{ ans[i] = c; if(c == 'A')eA = true; if(c == 'B')eB = true; if(c == 'C')eC = true; break; } } } if(rem == 1){ cout << ans << endl; } else{ cout << -1 << endl; } }