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;
int pos[(int)(1e6 + 10)], L[(int)(1e6 + 10)], R[(int)(1e6 + 10)],
    ans[(int)(1e6 + 10)];
struct nod {
  int l, r, id;
} a[(int)(1e6 + 10)];
struct tnod {
  int val, id;
} c[(int)(1e6 + 10)];
int cmp(nod x, nod y) {
  if (x.l == y.l) {
    if (x.r == y.r) return x.id < y.id;
    return x.r < y.r;
  }
  return x.l < y.l;
}
set<pair<int, int> > st;
void build(int rt, int l, int r) {
  if (l == r) {
    c[rt].val = L[pos[l]];
    c[rt].id = l;
    return;
  }
  int mid = (l + r) >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  tnod ls = c[rt << 1], rs = c[rt << 1 | 1];
  tnod minn = ls.val < rs.val ? ls : rs;
  c[rt] = minn;
}
pair<int, int> query(int rt, int l, int r, int ql, int qr) {
  if (qr < l || ql > r) return make_pair(0x7f7f7f7f, -2);
  if (qr >= r && ql <= l) return make_pair(c[rt].val, c[rt].id);
  int mid = (l + r) >> 1;
  pair<int, int> ls = query(rt << 1, l, mid, ql, qr);
  pair<int, int> rs = query(rt << 1 | 1, mid + 1, r, ql, qr);
  return ls.first < rs.first ? ls : rs;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].l, &a[i].r);
    a[i].id = i, L[i] = a[i].l, R[i] = a[i].r;
  }
  sort(a + 1, a + 1 + n, cmp);
  int p = 1;
  for (int i = 1; i <= n; i++) {
    while (p <= n && a[p].l <= i) {
      st.insert(make_pair(a[p].r, a[p].id));
      p++;
    }
    pos[i] = st.begin()->second;
    st.erase(st.begin());
  }
  for (int i = 1; i <= n; i++) ans[pos[i]] = i;
  build(1, 1, n);
  int flag = 0, u, v;
  for (int i = 1; i <= n; i++) {
    if (i + 1 > R[pos[i]]) continue;
    pair<int, int> temp = query(1, 1, n, i + 1, R[pos[i]]);
    if (temp.first <= i) {
      flag = 1;
      u = pos[temp.second], v = pos[i];
      break;
    }
  }
  if (!flag) {
    printf("YES\n");
    for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  } else {
    printf("NO\n");
    for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
    printf("\n");
    swap(ans[u], ans[v]);
    for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  }
  return 0;
}