func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> G[500005];   void solve() {     int n, m, i, a, b;     cin >> n >> m;     vector<pair<int, int>> topics(n + 1);     vector<int> assigned(n + 1, 1);     vector<bool> done(n + 1, 0);     for (i = 0; i < m; ++i) {       cin >> a >> b;       G[a].push_back(b);       G[b].push_back(a);     }     for (i = 1; i <= n; ++i) {       cin >> topics[i].first;       topics[i].second = i;     }     sort(topics.begin() + 1, topics.end());     for (i = 1; i <= n; ++i) {       if (assigned[topics[i].second] != topics[i].first) {         cout << -1 << endl;         return;       }       done[topics[i].second] = 1;       for (int child : G[topics[i].second]) {         if (!done[child] && assigned[child] == assigned[topics[i].second])           assigned[child] = assigned[topics[i].second] + 1;       }     }     for (i = 1; i <= n; ++i) cout << topics[i].second <<    ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     solve();   }   