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 LEN = 100000;
struct fastio {
  int it, len;
  char s[LEN + 5];
  fastio() { it = len = 0; }
  char get() {
    if (it < len) return s[it++];
    it = 0, len = fread(s, 1, LEN, stdin);
    return len ? s[it++] : EOF;
  }
  bool notend() {
    char c;
    for (c = get(); c == ' ' || c == '\n' || c == '\r'; c = get())
      ;
    if (it) it--;
    return c != EOF;
  }
  void put(char c) {
    if (it == LEN) fwrite(s, 1, LEN, stdout), it = 0;
    s[it++] = c;
  }
  void flush() { fwrite(s, 1, it, stdout); }
} buff;
inline int getint() {
  char c;
  int res = 0, sig = 1;
  for (c = buff.get(); c < '0' || c > '9'; c = buff.get())
    if (c == '-') sig = -1;
  for (; c >= '0' && c <= '9'; c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline long long getll() {
  char c;
  long long res = 0, sig = 1;
  for (c = buff.get(); c < '0' || c > '9'; c = buff.get())
    if (c == '-') sig = -1;
  for (; c >= '0' && c <= '9'; c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
int n;
vector<int> ans1, ans2;
struct Info {
  int a, b, id;
  bool operator<(const Info &x) const {
    return make_pair(a, b) < make_pair(x.a, x.b);
  }
} m[200005], chk[200005];
bool cmpid(Info x, Info y) { return x.id < y.id; }
int t[18][200005];
int qmin(int l, int r) {
  if (l > r) return n + 1;
  int ro = 31 - __builtin_clz(r - l);
  return min(t[ro][l], t[ro][r - (1 << ro) + 1]);
}
int main() {
  n = getint();
  ans1.resize(n + 1);
  ans2.resize(n + 1);
  for (int i = 1; i <= n; i++) {
    m[i].a = getint(), m[i].b = getint(), m[i].id = i;
  }
  sort(m + 1, m + n + 1);
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      que;
  int k = 1;
  for (int i = 1; i <= n; i++) {
    while (k <= n && m[k].a == i) {
      que.push(make_pair(m[k].b, m[k].id));
      k++;
    }
    ans1[que.top().second] = i;
    que.pop();
  }
  ans2 = ans1;
  sort(m + 1, m + n + 1, cmpid);
  for (int i = 1; i <= n; i++) chk[ans1[i]] = (Info){m[i].a, m[i].b, i};
  for (int i = 1; i <= n; i++) t[0][i] = chk[i].a;
  for (int i = 1; i <= 17; i++) {
    for (int j = 1; j + (1 << i) - 1 <= n; j++) {
      t[i][j] = min(t[i - 1][j], t[i - 1][j + (1 << (i - 1))]);
    }
  }
  bool ok = true;
  for (int i = n; i >= 1; i--) {
    if (chk[i].b == i) continue;
    int mini = qmin(i + 1, chk[i].b);
    if (mini > i) continue;
    for (int j = i + 1; j <= chk[i].b; j++) {
      if (chk[j].a <= i) {
        swap(ans2[chk[i].id], ans2[chk[j].id]);
        break;
      }
    }
    ok = false;
    break;
  }
  if (ok) {
    puts("YES");
    for (int i = 1; i <= n; i++) printf("%d%c", ans1[i], i == n ? '\n' : ' ');
  } else {
    puts("NO");
    for (int i = 1; i <= n; i++) printf("%d%c", ans1[i], i == n ? '\n' : ' ');
    for (int i = 1; i <= n; i++) printf("%d%c", ans2[i], i == n ? '\n' : ' ');
  }
  return 0;
}