func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2004;   int pa[N];   int n, m, x, y, op, pos = 1, ans = 0;   pair<int, int> p[N];   bool b[N];   int main() {     scanf( %d %d , &n, &m);     for (int i = 1; i <= n * 2; i++) {       scanf( %d , &p[i].first);       p[i].second = i;     }     for (int i = 0; i < m; i++) {       scanf( %d %d , &x, &y);       pa[x] = y;       pa[y] = x;     }     sort(p + 1, p + 2 * n + 1, greater<pair<int, int> >());     scanf( %d , &op);     for (int i = 1; i <= n; i++) {       if (op == 1) {         bool g = 0;         for (int i = pos; i <= 2 * n; i++)           if (!b[p[i].second] && pa[p[i].second] != 0) {             ans = p[i].second;             g = 1;             break;           }         if (!g) {           for (; pos <= 2 * n && b[p[pos].second]; ++pos)             ;           ans = p[pos].second;         }         b[ans] = 1;         cout << ans << endl;         scanf( %d , &x);         b[x] = 1;       } else {         scanf( %d , &x);         b[x] = 1;         if (pa[x] == 0 || b[pa[x]]) {           bool g = 0;           for (int i = pos; i <= 2 * n; i++)             if (!b[p[i].second] && pa[p[i].second] != 0) {               ans = p[i].second;               g = 1;               break;             }           if (!g) {             for (; pos <= 2 * n && b[p[pos].second]; ++pos)               ;             ans = p[pos].second;           }         } else {           ans = pa[x];           b[pa[x]] = 1;         }         b[ans] = 1;         cout << ans << endl;       }     }   }   