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>
long long gi() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f ? x : -x;
}
std::mt19937 rnd(time(NULL));
template <class T>
void cxk(T& a, T b) {
  a = a > b ? a : b;
}
template <class T>
void cnk(T& a, T b) {
  a = a < b ? a : b;
}
int n;
struct intv {
  int l, r, i, _i;
} s[200010], A[200010];
bool operator<(const intv& a, const intv& b) { return a.r > b.r; }
std::priority_queue<intv> que;
intv seg[800010];
void build(int x, int l, int r) {
  if (l == r) {
    seg[x] = {n + 1, n + 1, 0};
    return;
  }
  build(x << 1, l, ((l + r) >> 1)), build(x << 1 | 1, ((l + r) >> 1) + 1, r);
  seg[x] = std::max(seg[x << 1], seg[x << 1 | 1]);
}
void update(int x, int l, int r, int p) {
  if (l == r) {
    seg[x] = A[l];
    return;
  }
  if (p <= ((l + r) >> 1))
    update(x << 1, l, ((l + r) >> 1), p);
  else
    update(x << 1 | 1, ((l + r) >> 1) + 1, r, p);
  seg[x] = std::max(seg[x << 1], seg[x << 1 | 1]);
}
int nxt[200010], st[18][200010], sec[200010], pos[200010];
intv query(int x, int l, int r, int L, int R) {
  if (L <= l && r <= R) return seg[x];
  if (L <= ((l + r) >> 1))
    if (((l + r) >> 1) < R)
      return std::max(query(x << 1, l, ((l + r) >> 1), L, R),
                      query(x << 1 | 1, ((l + r) >> 1) + 1, r, L, R));
    else
      return query(x << 1, l, ((l + r) >> 1), L, R);
  else
    return query(x << 1 | 1, ((l + r) >> 1) + 1, r, L, R);
}
int main() {
  n = gi();
  for (int i = 1; i <= n; ++i) s[i].l = gi(), s[i].r = gi(), s[i]._i = i;
  std::sort(s + 1, s + n + 1, [](intv a, intv b) { return a.l < b.l; });
  for (int i = 1, j = 1; i <= n; ++i) {
    while (j <= n && s[j].l == i) que.push(s[j++]);
    A[i] = que.top(), que.pop();
    if (!que.empty()) sec[i] = que.top()._i;
  }
  for (int i = 1; i <= n; ++i) pos[A[i]._i] = i;
  for (int i = 1; i <= n; ++i) sec[i] = pos[sec[i]];
  build(1, 1, n);
  {
    static int st[200010];
    for (int i = 1; i <= n; ++i) A[i].i = i, st[i] = i;
    std::sort(st + 1, st + n + 1,
              [&](int a, int b) { return A[a].r > A[b].r; });
    for (int l = 1, r = n; l <= n; l = r + 1) {
      r = l;
      while (A[st[r] + 1].r == A[st[r]].r) ++r;
      for (int _ = l, i; _ <= r; ++_)
        if (i = st[_], i < A[i].r) {
          nxt[i] = query(1, 1, n, i + 1, A[i].r).i;
        }
      for (int i = l; i <= r; ++i) update(1, 1, n, st[i]);
    }
  }
  static int perm[200010];
  for (int j = 1; j <= n; ++j) st[0][j] = nxt[j];
  for (int i = 1; i < 18; ++i)
    for (int j = 1; j <= n; ++j) st[i][j] = st[i - 1][st[i - 1][j]];
  for (int i = 1; i <= n; ++i) perm[A[i]._i] = i;
  for (int i = 1; i <= n; ++i)
    if (sec[i]) {
      int x = i;
      for (int j = 17; ~j; --j)
        if (st[j][x] && st[j][x] < sec[i] && A[st[j][x]].r < A[sec[i]].r)
          x = st[j][x];
      if (A[x].r >= sec[i]) {
        puts("NO");
        for (int i = 1; i <= n; ++i) printf("%d ", perm[i]);
        puts("");
        std::vector<int> vi;
        for (int j = i; j && j <= x; j = nxt[j]) vi.push_back(j);
        vi.push_back(sec[i]);
        intv _ = A[sec[i]];
        int lst = 0;
        std::reverse((vi).begin(), (vi).end());
        for (int i : vi) A[lst] = A[i], lst = i;
        A[i] = _;
        for (int i = 1; i <= n; ++i) perm[A[i]._i] = i;
        for (int i = 1; i <= n; ++i) printf("%d ", perm[i]);
        puts("");
        exit(0);
      }
    }
  puts("YES");
  for (int i = 1; i <= n; ++i) printf("%d ", perm[i]);
  return 0;
}