#include #include #include #include using namespace std; using ll = long long; ll get_most(char reg, ll times, ll &all_times) { map mp; for (ll i = 0; i < times; i++) { cout << "? " << reg << endl; all_times++; ll val; cin >> val; if (val == -1) { return -1; } mp[val]++; } ll max_times = 0; ll max_val = -1; for (auto it = mp.begin(); it != mp.end(); it++) { if (max_times < it->second) { max_times = it->second; max_val = it->first; } } return max_val; } int main() { ll all_times = 0; ll x = get_most('A', 30, all_times); ll y = get_most('B', 30, all_times); ll now = 2; for (ll i = 0; i < y; i++) { if (now == 2) { while (true) { cout << "+ A C B" << endl; ll z; cin >> z; if (z != 0) { assert(all_times <= 8888); return 0; } all_times++; ll val = get_most('B', 7, all_times); if (val == -1) { assert(all_times <= 8888); return 0; } if (val == i * x + x) { break; } } now = 1; } else { while (true) { cout << "+ A B C" << endl; all_times++; ll z; cin >> z; if (z != 0) { assert(all_times <= 8888); return 0; } ll val = get_most('C', 7, all_times); if (val == -1) { assert(all_times <= 8888); return 0; } if (val == i * x + x) { break; } } now = 2; } } if (now == 1) { cout << "! B" << endl; } else { cout << "! C" << endl; } }