func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   void out(T x) {     cout << x << endl;     exit(0);   }   const long long mod = 1e9 + 7;   const int maxn = 1e6 + 5;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   int n, start, x;   int ans = 1e9 + 10;   int beforeVal = -1;   int beforeIdx;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> start >> x;     beforeIdx = start;     vector<int> v;     for (int i = 1; i <= n; i++) {       v.push_back(i);     }     shuffle(v.begin(), v.end(), rng);     v.resize(min(n, 999));     for (int q : v) {       cout <<  ?   << q << endl;       cout.flush();       int val;       int nxt;       cin >> val >> nxt;       if (val >= x) {         ans = min(ans, val);       } else {         if (val > beforeVal) {           beforeVal = val;           beforeIdx = nxt;         }       }     }     for (int i = 0; i < 1000; i++) {       if (beforeIdx == -1) break;       cout <<  ?   << beforeIdx << endl;       cout.flush();       int val;       int nxt;       cin >> val >> nxt;       if (val >= x) {         ans = min(ans, val);       }       beforeIdx = nxt;     }     if (ans == 1e9 + 10) ans = -1;     cout <<  !   << ans << endl;     cout.flush();     return 0;   }   