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 inf = 1e9 + 10;
const int maxn = 2e5 + 10;
int n, ans[maxn], root, topt, lc[maxn];
struct da {
  int a, b, id;
} q[maxn];
struct daa {
  int lc, rc, mi, id;
} a[4 * maxn];
priority_queue<pair<int, int> > qq;
inline bool cmp(da aa, da bb) {
  if (aa.a == bb.a) return aa.b < bb.b;
  return aa.a < bb.a;
}
void build_tree(int &n, int l, int r) {
  n = ++topt;
  a[n].mi = inf;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build_tree(a[n].lc, l, mid);
  build_tree(a[n].rc, mid + 1, r);
}
void updata(int n) {
  if (a[a[n].lc].mi < a[a[n].rc].mi)
    a[n].mi = a[a[n].lc].mi, a[n].id = a[a[n].lc].id;
  else
    a[n].mi = a[a[n].rc].mi, a[n].id = a[a[n].rc].id;
}
void tree_add(int n, int l, int r, int lc, int k, int idd) {
  if (l == r) {
    a[n].mi = k;
    a[n].id = idd;
    return;
  }
  int mid = (l + r) >> 1;
  if (lc <= mid)
    tree_add(a[n].lc, l, mid, lc, k, idd);
  else
    tree_add(a[n].rc, mid + 1, r, lc, k, idd);
  updata(n);
}
daa qury(int n, int L, int R, int l, int r) {
  if (L == l && R == r) return a[n];
  int mid = (L + R) >> 1;
  if (r <= mid)
    return qury(a[n].lc, L, mid, l, r);
  else if (l >= mid + 1)
    return qury(a[n].rc, mid + 1, R, l, r);
  else {
    daa now1 = qury(a[n].lc, L, mid, l, mid);
    daa now2 = qury(a[n].rc, mid + 1, R, mid + 1, r);
    if (now1.mi < now2.mi)
      return now1;
    else
      return now2;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &q[i].a, &q[i].b), q[i].id = i;
  sort(q + 1, q + n + 1, cmp);
  build_tree(root, 1, n);
  int p = 0;
  for (int i = 1; i <= n; i++) {
    while (p + 1 <= n && q[p + 1].a <= i) p++, qq.push(make_pair(-q[p].b, p));
    pair<int, int> now = qq.top();
    qq.pop();
    ans[q[now.second].id] = i;
    lc[i] = now.second;
  }
  for (int i = 1; i <= n; i++) tree_add(root, 1, n, i, q[lc[i]].a, q[lc[i]].id);
  for (int i = 1; i <= n; i++) {
    tree_add(root, 1, n, i, inf, 0);
    daa now = qury(root, 1, n, i, q[lc[i]].b);
    if (now.mi <= i) {
      printf("NO\n");
      for (int j = 1; j <= n; j++)
        printf("%d%c", ans[j], (j == n ? '\n' : ' '));
      swap(ans[q[lc[i]].id], ans[now.id]);
      for (int j = 1; j <= n; j++)
        printf("%d%c", ans[j], (j == n ? '\n' : ' '));
      return 0;
    }
    tree_add(root, 1, n, i, q[i].a, q[i].id);
  }
  printf("YES\n");
  for (int i = 1; i <= n; i++) printf("%d%c", ans[i], (i == n ? '\n' : ' '));
  return 0;
}