#include #define rep(i, a, b) for(int i = (a); i <= (b); i ++) using std::cin, std::cout, std::cerr; using ll = long long; int main() { std::ios::sync_with_stdio(false); int n, k; cin >> n >> k; auto check = [](int x) { while(x > 0) { if(x % 8 == 0b110) return true; x /= 2; } return false; }; int x = 0; while(k > 0) { x ++; if(check(x)) k --; } std::string ans = ""; while(x > 0) { ans = std::string() + ((x & 1) ? "M" : "A") + ans; x /= 2; } ans = std::string(n - ans.size(), 'A') + ans; cout << ans << '\n'; }