#include "combo.h"
#include <iostream>
using namespace std;
int n;
std::string guess_sequence(int N)
{
n = N;
string ans;
char b, x, y;
if (press("AB") > 0)
{
if (press("A") > 0)
{
ans = "A";
b = 'B';
x = 'X';
y = 'Y';
}
else
{
ans = "B";
b = 'A';
x = 'X';
y = 'Y';
}
}
else
{
if (press("X") > 0)
{
ans = "X";
b = 'A';
x = 'B';
y = 'Y';
}
else
{
ans = "Y";
b = 'A';
x = 'B';
y = 'X';
}
}
for (int i = 2; i < n; i++)
{
int res = press(ans + b + ans + x + b + ans + x + x + ans + x + y);
if (res == ans.size())
ans += y;
else if (res == ans.size() + 1)
ans += b;
else
ans += x;
}
if (press(ans + b) == n)
ans += b;
else if (press(ans + x) == n)
ans += x;
else
ans += y;
return ans;
}