#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
char a[4] = {'A','B','Y','X'};
string guess_sequence(int N) {
string p = "";
if(N == 1){
for(int i = 0;i < 3;i++){
string x;
x += a[i];
int v = press(x);
if(v == 1){
p += a[i];
swap(a[0],a[i]);
break;
}
}
if(p.empty()){
p += a[3];
swap(a[0],a[3]);
}
return p;
}
string S = "AB";
int val1 = press(S);
if(val1 == 1){
string S2 = "A";
int val2 = press(S2);
if(val2 == 0)swap(a[0],a[1]);
}
else{
string S2 = "X";
int val2 = press(S2);
if(val2 == 1)swap(a[0],a[3]);
else swap(a[0],a[2]);
}
p += a[0];
for(int i = 1;i < N - 1;i++){
string t = p + a[1] + a[1] + p + a[1] + a[2] + p + a[1] + a[3] + p + a[2];
int x = press(t);
if(x == i)p += a[3];
else if(x == i + 1)p += a[2];
else p += a[1];
}
for(int i = 1;i < 3;i++){
string x = p + a[i];
int v = press(x);
if(v == N){
p += a[i];
break;
}
}
if((int)p.size() < N)p += a[3];
return p;
}