#include "combo.h"
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
using namespace std;
int press(std::string p);
std::string guess_sequence(int N) {
int n=N;
std::string p = "";
std::string s1 = "AB";
std::string s2 = "AX";
char v[4]={'A','B','X','Y'};
int r1=press(s1);
int r2=press(s2);
//cout<<r1<<" "<<r2<<'\n';
if(r1==0 && r2==0)
{
swap(v[0],v[3]);
}
if(r1==0 && r2!=0)
{
swap(v[0],v[2]);
}
if(r1!=0 && r2==0)
{
swap(v[0],v[1]);
}
p.push_back(v[0]);
int sz=1;
while(p.size()+2<=n)
{
s1=p+v[1]+v[1]+p+v[1]+v[2]+p+v[1]+v[3]+p+v[2];
int rez=press(s1);
if(rez==p.size())
{
p.push_back(v[3]);
}
else if(rez==p.size()+1)
{
p.push_back(v[2]);
}
else
{
p.push_back(v[1]);
}
}
if(p.size()<n)
{
int rez1=press(p+v[1]+p+v[2]);
int rez2=press(p+v[1]);
if(rez1==p.size()+1)
{
if(rez2==p.size()+1)
{
p.push_back(v[1]);
}
else
{
p.push_back(v[2]);
}
}
else
{
p.push_back(v[3]);
}
}
//cout<<p<<'\n';
return p;
}