Problem: There are N cities in Bob's country connected by roads. Some pairs of cities are connected by public transport. There are two competing transport companies — Boblines operating buses and Bobrail running trains. When traveling from A to B, a passenger always first selects the mode of transport (either bus or train), and then embarks on a journey. For every pair of cities, there are exactly two ways of how to travel between them without visiting any city more than once — one using only bus routes, and the second using only train routes. Furthermore, there is no pair of cities that is directly connected by both a bus route and a train route.

You obtained the plans of each of the networks. Unfortunately, each of the companies uses different names for the same cities. More precisely, the bus company numbers the cities using integers from 1 to N, while the train company uses integers between N + 1 and 2N. Find one possible mapping between those two numbering schemes, such that no pair of cities is connected directly by both a bus route and a train route. Note that this mapping has to map different cities to different cities.

Input

The first line contains an integer N (2 ≤ N ≤ 10000), the number of cities.

N - 1 lines follow, representing the network plan of Boblines. Each contains two integers u and v (1 ≤ u, v ≤ N), meaning that there is a bus route between cities u and v.

N - 1 lines follow, representing the network plan of Bobrail. Each contains two integers u and v (N + 1 ≤ u, v ≤ 2N), meaning that there is a train route between cities u and v.

Output

If there is no solution, output a single line with the word "No".

If a solution exists, output two lines. On the first line, there should be the word "Yes". On the second line, there should be N integers P1, P2, ..., PN (N + 1 ≤ Pi ≤ 2N) — the mapping between the two numbering schemes. More precisely, for i ≠ j it should be Pi ≠ Pj, and for every direct bus route (i, j), there is no direct train route between (Pi, Pj).

If there are multiple solutions, you may print any of them.

Examples

Input

4
1 2
2 3
3 4
5 6
6 7
7 8


Output

Yes
6 8 5 7


Input

4
1 2
2 3
3 4
5 6
5 7
5 8


Output

No


Input

7
1 2
1 3
1 4
1 5
5 6
6 7
8 9
9 10
10 11
11 12
12 13
13 14


Output

Yes
9 14 11 12 13 10 8

Note

The first sample (bus lines in red and rail lines in blue):

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chkmin(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
inline void chkmax(T1 &x, T2 y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const pair<T, U> &_p) {
  _out << _p.first << ' ' << _p.second;
  return _out;
}
template <typename T, typename U>
inline istream &operator>>(istream &_in, pair<T, U> &_p) {
  _in >> _p.first >> _p.second;
  return _in;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const vector<T> &_v) {
  if (_v.empty()) {
    return _out;
  }
  _out << _v.front();
  for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline istream &operator>>(istream &_in, vector<T> &_v) {
  for (auto &_i : _v) {
    _in >> _i;
  }
  return _in;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const set<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const multiset<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const unordered_set<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const unordered_multiset<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const map<T, U> &_m) {
  if (_m.empty()) {
    return _out;
  }
  _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')';
  for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) {
    _out << ", (" << _it->first << ": " << _it->second << ')';
  }
  return _out;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const unordered_map<T, U> &_m) {
  if (_m.empty()) {
    return _out;
  }
  _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')';
  for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) {
    _out << ", (" << _it->first << ": " << _it->second << ')';
  }
  return _out;
}
const string FILENAME = "input";
const int MAXN = 10001;
int n;
bool v[MAXN][MAXN];
vector<int> g[MAXN * 2];
int ans[MAXN * 2];
int who[MAXN * 2];
bool check() {
  for (int i = 0; i < n; i++) {
    who[ans[i]] = i;
  }
  bool bad = false;
  for (int i = n; i < 2 * n; i++) {
    for (auto first : g[i]) {
      if (v[who[i]][who[first]]) {
        bad = true;
        break;
      }
    }
    if (bad) {
      break;
    }
  }
  if (bad) {
    return false;
  }
  return true;
}
int badv;
inline void link(int a, int b) {
  if (a >= n) {
    ans[b] = a;
  } else {
    ans[a] = b;
  }
}
bool bads[MAXN * 2];
void gen() {
  int l = 0;
  int r = n - 1;
  int l1 = n;
  int r1 = n + n - 1;
  if (badv < n) {
    l += n;
    r += n;
    l1 -= n;
    r1 -= n;
  }
  vector<int> s;
  for (int i = l; i <= r; i++) {
    if ((int)(g[i]).size() == 1) {
      s.push_back(i);
    }
  }
  if ((int)(s).size() == 0) {
    cout << "No\n";
    exit(0);
  }
  int t = s[rand() % (int)(s).size()];
  link(badv, t);
  int d = g[t][0];
  for (auto first : g[badv]) {
    bads[first] = true;
  }
  vector<int> s1;
  for (int i = l1; i <= r1; i++) {
    if (!bads[i] && i != badv) {
      s1.push_back(i);
    }
  }
  if ((int)(s1).size() == 0) {
    cout << "No\n";
    exit(0);
  }
  int t1 = s1[rand() % (int)(s1).size()];
  link(d, t1);
  vector<int> g;
  for (int i = n; i < 2 * n; i++) {
    if (i != badv && i != t1 && i != t && i != d) {
      g.push_back(i);
    }
  }
  random_shuffle((g).begin(), (g).end());
  int uk = 0;
  for (int i = 0; i < n; i++) {
    if (i != badv && i != t1 && i != t && i != d) {
      ans[i] = g[uk];
      uk++;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  time_t cur = clock();
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    v[a][b] = true;
    v[b][a] = true;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 0; i < n; i++) {
    ans[i] = i + n;
  }
  badv = 0;
  for (int i = 0; i < 2 * n; i++) {
    if ((int)(g[i]).size() > (int)(g[badv]).size()) {
      badv = i;
    }
  }
  while (true) {
    gen();
    if (check()) {
      cout << "Yes\n";
      for (int i = 0; i < n; i++) {
        cout << ans[i] + 1 << ' ';
      }
      cout << '\n';
      return 0;
    }
    if (double(clock() - cur) / CLOCKS_PER_SEC >= 3.8) {
      break;
    }
  }
  cout << "No\n";
  return 0;
}