func_code_string: #include <bits/stdc++.h>   using namespace std;   const string FILENAME =  input ;   vector<pair<int, int> > best;   vector<int> a;   int main() {     int n, m;     cin >> n >> m;     vector<int> has(2 * n, 0);     vector<int> pr(2 * n, -1);     vector<pair<int, int> > next(2 * n, {0, 0});     for (int i = 0; i < 2 * n; i++) {       int t;       cin >> t;       a.push_back(t);       next[i] = {-a[i], i};     }     sort((next).begin(), (next).end());     for (int i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       x--;       y--;       pr[x] = y;       pr[y] = x;       if (a[x] > a[y]) {         swap(x, y);       }       best.push_back({y, x});     }     int ans;     int cnt = 0;     int t;     cin >> t;     if (t == 1) {       for (int i = 0; i < m; i++) {         cout << best[i].first + 1 << endl;         cin >> ans;         if (ans == -1) return 0;         has[best[i].first] = 1;         has[ans - 1] = 1;       }       for (int i = 0; i < 2 * n; i++) {         if (has[next[i].second] == 0) {           cout << next[i].second + 1 << endl;           cin >> ans;           if (ans == -1) return 0;           has[ans - 1] = 1;           has[next[i].second] = 1;         }       }       return 0;     }     cin >> ans;     ans--;     has[ans] = 1;     cnt++;     while (pr[ans] != -1) {       cout << pr[ans] + 1 << endl;       cnt++;       if (cnt == 2 * n) return 0;       has[pr[ans]] = 1;       cin >> ans;       cnt++;       if (ans == -1) return 0;       ans--;       has[ans] = 1;     }     for (int i = 0; i < m; i++) {       if (has[best[i].first] == 0) {         has[best[i].first] = 1;         cout << best[i].first + 1 << endl;         cnt++;         if (cnt == 2 * n) return 0;         cin >> ans;         cnt++;         if (ans == -1) return 0;         ans--;         has[ans] = 1;       }     }     for (int i = 0; i < 2 * n; i++) {       if (has[next[i].second] == 0) {         cout << next[i].second + 1 << endl;         cnt++;         if (cnt == 2 * n) return 0;         cin >> ans;         cnt++;         if (ans == -1) return 0;         ans--;         has[ans] = 1;       }     }     return 0;   }   