func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     vector<long long> p(n);     vector<int> a(n), b(n);     for (int i = 0; i < n; ++i) cin >> p[i];     for (int i = 0; i < n; ++i) cin >> a[i];     for (int i = 0; i < n; ++i) cin >> b[i];     vector<pair<long long, int>> one, two, three;     for (int i = 0; i < n; ++i) {       if (a[i] == 1 || b[i] == 1) one.push_back({p[i], i});       if (a[i] == 2 || b[i] == 2) two.push_back({p[i], i});       if (a[i] == 3 || b[i] == 3) three.push_back({p[i], i});     }     sort(one.begin(), one.end());     sort(two.begin(), two.end());     sort(three.begin(), three.end());     vector<bool> vis(n, false);     int p1 = 0, p2 = 0, p3 = 0;     int si1 = one.size(), si2 = two.size(), si3 = three.size();     int m, c;     cin >> m;     for (int i = 0; i < m; ++i) {       cin >> c;       if (c == 1) {         bool fl = false;         for (int start = p1; start < si1; start++) {           if (vis[one[start].second] == false) {             cout << one[start].first <<    ;             vis[one[start].second] = true;             fl = true;             p1 = start + 1;             break;           }         }         if (!fl) cout <<  -1  ;       } else if (c == 2) {         bool fl = false;         for (int start = p2; start < si2; start++) {           if (vis[two[start].second] == false) {             cout << two[start].first <<    ;             vis[two[start].second] = true;             fl = true;             p2 = start + 1;             break;           }         }         if (!fl) cout <<  -1  ;       } else {         bool fl = false;         for (int start = p3; start < si3; start++) {           if (vis[three[start].second] == false) {             cout << three[start].first <<    ;             vis[three[start].second] = true;             fl = true;             p3 = start + 1;             break;           }         }         if (!fl) cout <<  -1  ;       }     }   }   