rt,WA 4。
int query(int a, int b) {
printf("? %d %d\n", a, b);
fflush(stdout);
static int ans;
ans = read<int>();
if (ans == -1) exit(0);
return ans;
}
int find_max(int a, int b, int c, int d) {
int p = query(a, c);
if (p == 1)
return query(a, d) == 1 ? a : d;
if (p == 0)
return query(b, d) == 1 ? b : d;
if (p == 2)
return query(c, b) == 1 ? c : b;
exit(-1);
}
void solve() {
int N = read<int>();
if (N == -1) exit(0);
if (N == 1) {
printf("! %d\n", query(1, 2));
fflush(stdout);
return;
}
std::queue<int> p;
for (int i = 1; i <= (1 << N); ++i) p.push(i);
if (N % 2 == 1) {
int t = 1 << (N - 1);
while (t--) {
int a = p.front(); p.pop();
int b = p.front(); p.pop();
p.push(query(a, b) == 1 ? a : b);
}
}
while (p.size() != 1) {
int t = (int)p.size() / 4;
while (t--) {
int a = p.front(); p.pop();
int b = p.front(); p.pop();
int c = p.front(); p.pop();
int d = p.front(); p.pop();
p.push(find_max(a, b, c, d));
}
}
printf("! %d\n", p.front());
fflush(stdout);
}
int main() {
int T = read<int>();
while (T--) solve();
return 0;
}