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 n, m, i, j, k, res[200500], st1[200500][20], st2[200500][20];
int l2(int n) {
  int r = 0;
  while (n - 1) {
    r++;
    n >>= 1;
  }
  return r;
}
int chk1(int l, int r) {
  int k = l2(r - l + 1);
  return max(st1[l][k], st1[r - (1 << k) + 1][k]);
}
int chk2(int l, int r) {
  int k = l2(r - l + 1);
  return min(st2[l][k], st2[r - (1 << k) + 1][k]);
}
struct sb {
  int id, l, r;
  bool operator<(const sb x) const { return r > x.r; }
} tmp, s[200500];
vector<sb> v[200500];
priority_queue<sb> q;
void ans() {
  for (int i = 1; i <= n; i++) {
    printf("%d ", res[i]);
  }
  puts("");
}
int main() {
  memset(st2, 0x3f, sizeof(st2));
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &j, &k);
    s[i].id = i;
    s[i].l = j;
    s[i].r = k;
    v[j].push_back(s[i]);
  }
  for (i = 1; i <= n; i++) {
    for (auto j : v[i]) {
      q.push(j);
    }
    s[i] = q.top();
    q.pop();
    res[s[i].id] = i;
    st1[i][0] = s[i].r;
    st2[i][0] = s[i].l;
  }
  for (j = 1; j <= 18; j++) {
    for (i = 1; i + (1 << j) - 1 <= n; i++) {
      st1[i][j] = max(st1[i][j - 1], st1[i + (1 << (j - 1))][j - 1]);
      st2[i][j] = min(st2[i][j - 1], st2[i + (1 << (j - 1))][j - 1]);
    }
  }
  for (i = 1; i <= n; i++) {
    if (s[i].l < i && chk1(s[i].l, i - 1) >= i) {
      puts("NO");
      ans();
      for (j = i - 1;; j--) {
        if (s[j].r >= i) {
          swap(res[s[i].id], res[s[j].id]);
          break;
        }
      }
      ans();
      return 0;
    }
    if (s[i].r > i && chk2(i + 1, s[i].r) <= i) {
      puts("NO");
      ans();
      for (j = i + 1;; j++) {
        if (s[j].l <= i) {
          swap(res[s[i].id], res[s[j].id]);
          break;
        }
      }
      ans();
      return 0;
    }
  }
  puts("YES");
  ans();
}