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 
#include <bits/stdc++.h>
using namespace std;
int n, u = -1, v = -1;
struct A {
  int id, l, r;
} p[200000], q[200001];
int ans[200000];
bool operator<(A a, A b) { return a.r > b.r; }
bool operator>(A a, A b) { return a.r < b.r; }
inline bool comp(A a, A b) { return a.l < b.l; }
priority_queue<A> h;
void read(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &p[i].l, &p[i].r);
    p[i].id = i;
  }
  sort(p, p + n, comp);
  int pos = 0;
  for (int i = 1; i <= n; i++) {
    while (pos < n && p[pos].l < i) pos++;
    while (pos < n && p[pos].l == i) {
      h.push(p[pos]);
      pos++;
    }
    ans[h.top().id] = i;
    h.pop();
  }
  return;
}
int x, y;
int mini[800001], maxi[800001];
inline void build(int i, int l, int r) {
  if (l == r) {
    mini[i] = maxi[i] = l;
    return;
  }
  int m = (l + r) >> 1;
  build(i << 1, l, m);
  build(i << 1 | 1, m + 1, r);
  if (q[mini[i << 1]].l < q[mini[i << 1 | 1]].l)
    mini[i] = mini[i << 1];
  else
    mini[i] = mini[i << 1 | 1];
  if (q[maxi[i << 1]].l > q[maxi[i << 1 | 1]].l)
    maxi[i] = maxi[i << 1];
  else
    maxi[i] = maxi[i << 1 | 1];
  return;
}
inline int mn(int i, int l, int r) {
  if (x <= l && r <= y) return mini[i];
  int res, m = (l + r) >> 1, a = -1, b = -1;
  if (x <= m) a = mn(i << 1, l, m);
  if (m < y) b = mn(i << 1 | 1, m + 1, r);
  if (a != -1) res = a;
  if (b != -1 && (a == -1 || q[b].l < q[a].l)) res = b;
  return res;
}
inline int querymn(int l, int r) {
  x = l;
  y = r;
  return mn(1, 1, n);
}
inline int mx(int i, int l, int r) {
  if (x <= l && r <= y) return maxi[i];
  int res, m = (l + r) >> 1, a = -1, b = -1;
  if (x <= m) a = mx(i << 1, l, m);
  if (m < y) b = mx(i << 1 | 1, m + 1, r);
  if (a != -1) res = a;
  if (b != -1 && (a == -1 || q[b].r > q[a].r)) res = b;
  return res;
}
inline int querymx(int l, int r) {
  x = l;
  y = r;
  return mx(1, 1, n);
}
void print(void) {
  if (u == -1 || v == -1) {
    printf("YES\n%d", ans[0]);
    for (int i = 1; i < n; i++) printf(" %d", ans[i]);
    putchar('\n');
  } else {
    printf("NO\n%d", ans[0]);
    for (int i = 1; i < n; i++) printf(" %d", ans[i]);
    for (int i = 0; i < n; i++)
      if (ans[i] == u)
        ans[i] = v;
      else if (ans[i] == v)
        ans[i] = u;
    printf("\n%d", ans[0]);
    for (int i = 1; i < n; i++) printf(" %d", ans[i]);
    putchar('\n');
  }
  return;
}
int main(void) {
  read();
  for (int i = 0; i < n; i++) q[ans[p[i].id]] = p[i];
  build(1, 1, n);
  for (int i = 1; i <= n; i++) {
    if (q[i].l < i) {
      int t = querymx(q[i].l, i - 1);
      if (q[t].r >= i) {
        u = i;
        v = t;
        break;
      }
    }
    if (i < q[i].r) {
      int t = querymn(i + 1, q[i].r);
      if (i >= q[t].l) {
        u = i;
        v = t;
        break;
      }
    }
  }
  print();
  return 0;
}
