#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string S;
if (press("AB")) {
S += (press("A") ? "A" : "B");
} else {
S += (press("X") ? "X" : "Y");
}
vector<string> C;
for (string x : {"A", "B", "X", "Y"})
if (x != S)
C.push_back(x);
for (int i = 1; i < N - 1; i++) {
int r = press(S + C[0] + S + C[1] + C[0] + S + C[1] + C[1] + S + C[1] + C[2]);
if (r == int(size(S)) + 1)
S += C[0];
else if (r == int(size(S)) + 2)
S += C[1];
else
S += C[2];
}
if (int(size(S)) < N) {
if (press(S + "A" + S + "B") == N)
S += (press(S + "A") == N ? "A" : "B");
else
S += (press(S + "X") == N ? "X" : "Y");
}
return S;
}