func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long int mod = 1000000007;   long long int tc, cnt = 0, number, many, total = 0, query, require;   int rmove[8] = {1, 0, -1, 0, -1, 1, -1, 1};   int cmove[8] = {0, 1, 0, -1, 1, -1, -1, 1};   long long int modpow(long long int x, long long int y, long long int m) {     long long int res = 1;     while (y > 0) {       if (y & 1) res = (res * x) % m;       x = (x * x) % m;       y >>= 1;     }     return res;   }   long long int dist[305][305], path[305][305];   void FloydWarshall() {     for (int i = 0; i < many; i++) {       for (int j = 0; j < many; j++) {         for (int k = 0; k < many; k++) {           if (dist[j][i] + dist[i][k] < dist[j][k]) {             dist[j][k] = dist[j][i] + dist[i][k];             path[j][k] = path[i][k];           }         }       }     }   }   vector<int> answer;   void printPath(int a, int b) {     if (path[a][b] == a) return;     printPath(a, path[a][b]);     answer.push_back(path[a][b]);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     cin >> many;     for (int i = 0; i < many; i++) {       for (int j = 0; j < many; j++) {         dist[i][j] = 1e18;         path[i][j] = i;       }       dist[i][i] = 0;       path[i][i] = -1;     }     for (int i = 0; i < many - 1; i++) {       int a, b;       cin >> a >> b;       a--;       b--;       dist[a][b] = 1;       dist[b][a] = 1;     }     for (int i = 1; i < many; i++) {       int sum = 0;       for (int j = 0; j < many; j++) {         if (i == j) continue;         if (dist[i][j] == 1) sum++;       }       if (sum == 1) number++;     }     vector<int> vec;     vec.resize(number);     for (int i = 0; i < number; i++) {       cin >> vec[i];       vec[i]--;     }     FloydWarshall();     int now = 0;     answer.push_back(now);     for (int i = 0; i < number; i++) {       printPath(now, vec[i]);       answer.push_back(vec[i]);       now = vec[i];     }     printPath(now, 0);     answer.push_back(0);     if (answer.size() == 2 * many - 1) {       for (int i = 0; i < answer.size(); i++) cout << answer[i] + 1 <<    ;     } else       cout << -1;     cout <<   n ;     return 0;   }   