#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, th, tot = 0; cin >> n >> th; string ans(n, '?'); auto dfs = [&](auto dfs, int p, int S) -> void { if(p == n){ tot++; if(tot == th){ cout << ans << '\n'; exit(0); } return; } bool flg = (3 - __builtin_popcount(S)) + p == n; for(int i = 0; i < 3; i++){ if(flg && (S >> i & 1)) continue; ans[p] = 'A' + i; dfs(dfs, p + 1, S | (1 << i)); } }; dfs(dfs, 0, 0); cout << "-1\n"; }