#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,K; cin >> N >> K; bool end = false; string answer = ""; auto dfs = [&](auto dfs,int pos,bool ok,int last) -> void { if(last == 6) ok = true; if(pos == N){K -= ok; return;} dfs(dfs,pos+1,ok,last*2%8); if(K == 0){answer += 'A'; return;} dfs(dfs,pos+1,ok,last*2%8+1); if(K == 0) answer += 'M'; }; dfs(dfs,0,false,0); reverse(answer.begin(),answer.end()); cout << answer << endl; }