#include <bits/stdc++.h>   using namespace std;   int n;   vector<int> ways[400], a[400], num[400];   vector<int> ans;   struct edge {     int a, b;   };   vector<edge> gr;   bool dfs(int v, int f, int pr) {     if (v == f) return true;     for (int i = 0; i < a[v].size(); i++) {       if (a[v][i] != pr)         if (dfs(a[v][i], f, v)) return true;     }     return false;   }   void findway(int v, int f, int j) {     if (v == f) {       ways[j].push_back(v);       return;     }     for (int i = 0; i < a[v].size(); i++) {       if (dfs(a[v][i], f, v)) {         ways[j].push_back(v);         findway(a[v][i], f, j);         return;       }     }   }   int main() {     cin >> n;     for (int i = 0; i < n - 1; i++) {       int z, l;       cin >> z >> l;       a[l].push_back(z);       a[z].push_back(l);       num[l].push_back(i + 1);       num[z].push_back(i + 1);     }     int num = 0;     int k;     while (cin >> k) {       findway(1, k, num);       num++;     }     for (int i = 0; i < ways[0].size(); i++) {       ans.push_back(ways[0][i]);     }     for (int i = 1; i < num; i++) {       int j = 0;       while (ways[i - 1][j] == ways[i][j]) j++;       j--;       for (int z = ways[i - 1].size() - 2; z >= j; z--) {         ans.push_back(ways[i - 1][z]);       }       for (int z = j + 1; z < ways[i].size(); z++) {         ans.push_back(ways[i][z]);       }     }     for (int i = ways[num - 1].size() - 2; i >= 0; i--) {       ans.push_back(ways[num - 1][i]);     }     if (ans.size() != 2 * n - 1)       cout << -1;     else {       for (int i = 0; i < ans.size(); i++) {         cout << ans[i] <<    ;       }     }     return 0;   }   