Problem: Phoenix is trying to take a photo of his n friends with labels 1, 2, ..., n who are lined up in a row in a special order. But before he can take the photo, his friends get distracted by a duck and mess up their order.

Now, Phoenix must restore the order but he doesn't remember completely! He only remembers that the i-th friend from the left had a label between a_i and b_i inclusive. Does there exist a unique way to order his friends based of his memory? 

Input

The first line contains one integer n (1 ≤ n ≤ 2⋅10^5) — the number of friends.

The i-th of the next n lines contain two integers a_i and b_i (1 ≤ a_i ≤ b_i ≤ n) — Phoenix's memory of the i-th position from the left.

It is guaranteed that Phoenix's memory is valid so there is at least one valid ordering.

Output

If Phoenix can reorder his friends in a unique order, print YES followed by n integers — the i-th integer should be the label of the i-th friend from the left.

Otherwise, print NO. Then, print any two distinct valid orderings on the following two lines. If are multiple solutions, print any.

Examples

Input


4
4 4
1 3
2 4
3 4


Output


YES
4 1 2 3 


Input


4
1 3
2 4
3 4
2 3


Output


NO
1 3 4 2 
1 2 4 3 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
struct SegmentTree {
  int t[4 * N];
  int get(int v, int tl, int tr, int l, int r) {
    if (l > r) return 0;
    if (tl == l && tr == r) return t[v];
    int tm = (tl + tr) >> 1;
    return max(get(v * 2, tl, tm, l, min(r, tm)),
               get(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r));
  }
  void update(int v, int tl, int tr, int pos, int val) {
    if (tl == tr) {
      t[v] = val;
      return;
    }
    int tm = (tl + tr) >> 1;
    if (pos <= tm)
      update(v * 2, tl, tm, pos, val);
    else
      update(v * 2 + 1, tm + 1, tr, pos, val);
    t[v] = max(t[v * 2], t[v * 2 + 1]);
  }
};
SegmentTree stree;
vector<pair<int, int> > scanline[N];
int place[N];
int pl[N], pr[N];
int perm[N];
void solve() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int l, r;
    cin >> l >> r;
    scanline[l].push_back({r, i});
    pl[i] = l, pr[i] = r;
  }
  set<pair<int, int> > st;
  for (int l = 1; l <= n; l++) {
    for (auto x : scanline[l]) {
      st.insert(x);
    }
    int v = st.begin()->second;
    st.erase(st.begin());
    place[l] = v;
  }
  for (int i = 1; i <= n; i++) {
    int id = place[i];
    int getl = pl[id], getr = pr[id];
    if (stree.get(1, 1, n, getl, i - 1) >= i) {
      cout << "NO\n";
      for (int j = 1; j <= n; j++) perm[place[j]] = j;
      for (int j = 1; j <= n; j++) cout << perm[j] << " ";
      cout << "\n";
      for (int j = i - 1; j >= 1; j--) {
        int ngetl = j, ngetr = pr[place[j]];
        if (getl <= j && i <= ngetr) {
          swap(place[i], place[j]);
          break;
        }
      }
      for (int j = 1; j <= n; j++) perm[place[j]] = j;
      for (int j = 1; j <= n; j++) cout << perm[j] << " ";
      return;
    }
    stree.update(1, 1, n, i, getr);
  }
  cout << "YES\n";
  for (int i = 1; i <= n; i++) perm[place[i]] = i;
  for (int i = 1; i <= n; i++) cout << perm[i] << " ";
}
int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(20);
  solve();
}