#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
#define get press
string t="ABXY";
string guess_sequence(int n)
{
if (n==1)
{
for (int j=0;j<3;j++)
if (get(string(1,t[j])))
return string(1,t[j]);
return string(1,t[3]);
}
string s,q;
int st=0,en=4;
while (st+1<en)
{
int mid=(st+en)/2;
if (get(t.substr(0,mid)))
en=mid;
else
st=mid;
}
s+=t[en-1];
swap(t[3],t[en-1]);
for (int ct=2;ct<=n-1;ct++)
{
q=s,q+=t[0];
for (int j=0;j<3;j++)
q+=s, q+=t[1], q+=t[j];
int x=get(q);
if (x==ct)
s+=t[0];
else if(x==ct+1)
s+=t[1];
else
s+=t[2];
}
for (int j=0;j<2;j++)
{
q=s, q+=t[j];
if (get(q)==n) return q;
}
s+=t[2];
return s;
}