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>
int n, l[200005], r[200005], rk[200005], rk1[200005], p[200005];
struct cmp {
  bool operator()(int a, int b) { return r[a] > r[b]; }
};
int cmp1(int a, int b) { return l[a] < l[b]; }
int cmp2(int a, int b) { return p[a] < p[b]; }
std::priority_queue<int, std::vector<int>, cmp> q;
std::vector<int> G[200005];
struct segmentTree {
  int min[200005 << 2];
  int gmin(int a, int b) {
    if (r[a] > r[b]) return a;
    return b;
  }
  void modify(int l, int r, int p, int v, int rt) {
    if (l == r) {
      min[rt] = gmin(v, min[rt]);
      return;
    }
    int mid = (l + r) >> 1;
    if (p <= mid)
      modify(l, mid, p, v, rt << 1);
    else
      modify(mid + 1, r, p, v, rt << 1 | 1);
    min[rt] = gmin(min[rt << 1], min[rt << 1 | 1]);
  }
  int query(int l, int r, int L, int R, int rt) {
    if (l > R || r < L) return 0;
    if (l <= L && R <= r) return min[rt];
    return gmin(query(l, r, L, (L + R) >> 1, rt << 1),
                query(l, r, ((L + R) >> 1) + 1, R, rt << 1 | 1));
  }
} sgt;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &l[i], &r[i]);
    rk[i] = i;
    rk1[i] = i;
    G[l[i]].push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    for (int v : G[i]) q.push(v);
    int u = q.top();
    q.pop();
    p[u] = i;
  }
  std::sort(rk1 + 1, rk1 + n + 1, cmp1);
  std::sort(rk + 1, rk + n + 1, cmp2);
  int p1 = 0;
  for (int i = 1; i <= n; ++i) {
    while (p1 < n && l[rk1[p1 + 1]] <= p[rk[i]]) {
      p1++;
      sgt.modify(1, n, p[rk1[p1]], rk1[p1], 1);
    }
    int d = sgt.gmin(sgt.query(l[rk[i]], p[rk[i]] - 1, 1, n, 1),
                     sgt.query(p[rk[i]] + 1, r[rk[i]], 1, n, 1));
    if (r[d] < r[rk[i]]) continue;
    printf("NO\n");
    for (int i = 1; i <= n; ++i) printf("%d ", p[i]);
    puts("");
    std::swap(p[rk[i]], p[d]);
    for (int i = 1; i <= n; ++i) printf("%d ", p[i]);
    return 0;
  }
  printf("YES\n");
  for (int i = 1; i <= n; ++i) printf("%d ", p[i]);
  return 0;
}