#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define tiii tuple<int,int,int>
#define tiiii tuple<int,int,int,int>
#define pb push_back
#define eb emplace_back
#define emp emplace
#define mkp make_pair
#define mkt make_tuple
#define vctr vector
#define arr array
#define all(x) x.begin(), x.end()
#define amin(a,b) a = min(a,b)
#define amax(a,b) a = max(a,b)
#define brick(x) cout << #x << " = " << (x) << " | "
#define dbg(x) cout << #x << " = " << (x) << '\n'
#define vdbg(a) cout << #a << " = "; for(auto _x : a)cout << _x << ' '; cout << '\n'
#define adbg(a,n) cout << #a << " = "; for(int _i = 1; _i <= n; ++_i)cout << a[_i] << ' '; cout << '\n'
#define adbg0(a,n) cout << #a << " = "; for(int _i = 0; _i < n; ++_i)cout << a[_i] << ' '; cout << '\n'
mt19937 rng(static_cast<uint32_t>(chrono::steady_clock::now().time_since_epoch().count()));
int uid(int a, int b) { return uniform_int_distribution<int>(a,b)(rng); }
ll uld(ll a, ll b) { return uniform_int_distribution<ll>(a,b)(rng); }
const int MOD = 1e9+7; // 998244353;
string guess_sequence(int n) {
char c[4] = {'A','B','X','Y'};
int idx = -1;
if (press(string(1,c[0])+string(1,c[1])) > 0) {
idx = (press(string(1,c[0])) ? 0 : 1);
} else {
idx = (press(string(1,c[2])) ? 2 : 3);
}
char d[3];
for (int j = 0; j < 4; ++j) {
if (idx == j)continue;
d[j-(idx < j)] = c[j];
}
string s = string(1,c[idx]);
for (int i = 2; i <= n-1; ++i) {
string cur = "";
cur += s;
cur += d[1];
cur += s;
cur += d[2];
cur += d[0];
cur += s;
cur += d[2];
cur += d[1];
cur += s;
cur += d[2];
cur += d[2];
// dbg(cur);
int res = press(cur);
s += d[res-(i-1)];
}
if (press(s+d[0]) == n)s += d[0];
else if (press(s+d[1]) == n)s += d[1];
else s += d[2];
return s;
}