#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
//string co;
/*int press(string slo)
{
cout << slo << endl;
int ile = 0;
for(int i = 0;i < slo.size();++i)
{
if(slo[i] != co[i]) break;
ile++;
}
cout << ile << endl;
return ile;
}*/
string guess_sequence(int n)
{
string p;
set<char> tab = {'A','B','X','Y'};
if(press("AB") > 0)
{
if(press("A") > 0)
{
p = "A";
tab.erase('A');
}
else
{
p = "B";
tab.erase('B');
}
}
else
{
if(press("X") > 0)
{
p = "X";
tab.erase('X');
}
else
{
p = "Y";
tab.erase('Y');
}
}
vector<char> tab1;
for(int j : tab) tab1.push_back(j);
while(p.size() <= n-2)
{
int j = press(p+tab1[0]+tab1[0]+p+tab1[0]+tab1[1]+p+tab1[0]+tab1[2]+p+tab1[1]);
if(j == p.size())
{
p += tab1[2];
}
else if(j == p.size()+1)
{
p += tab1[1];
}
else
{
p += tab1[0];
}
}
if(press(p+"A"+p+"B") == n)
{
if(press(p+"A") == n)
{
p += "A";
}
else
{
p += "B";
}
}
else
{
if(press(p+"X") == n)
{
p += "X";
}
else
{
p += "Y";
}
}
return p;
}