#include <bits/stdc++.h>   using namespace std;   int myrand(int m) { return (rand() * (1 << 15) + rand()) % m; }   int main() {     srand(time(0));     int n, ind, x;     cin >> n >> ind >> x;     --ind;     vector<int> left(n);     vector<bool> vis(n, 0);     for (int i = 0; i < n; ++i) left[i] = i;     vis[ind] = 1;     random_shuffle(left.begin(), left.end());     int best = -1;     for (int i = 0; i < min(1000, n); ++i) {       int v, ii = left[i];       cout <<  ?   << ii + 1 <<   n ;       fflush(stdout);       cin >> v >> ii;       if (v < x && v > best) {         ind = left[i];         best = max(best, v);       }     }     if (ind < 0) {       cout <<  ! -1 n ;       fflush(stdout);       return 0;     }     int itt, LIM = 999;     for (itt = 0; itt < LIM; ++itt) {       cout <<  ?   << ind + 1 <<   n ;       fflush(stdout);       int v;       cin >> v >> ind;       --ind;       if (v >= x) {         best = v;         break;       }       if (ind < 0) break;     }     if (itt == LIM) {       int j = 1;       while (1) {         j = j + 1;       }     }     cout <<  !   << ((best < x) ? -1 : best) <<   n ;     fflush(stdout);   }   