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 inf;
const double eps = 1e-8;
const double pi = acos(-1.0);
template <class T, class T2>
int chkmin(T &a, T2 b) {
  return a > b ? a = b, 1 : 0;
}
template <class T, class T2>
int chkmax(T &a, T2 b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
T sqr(T a) {
  return a * a;
}
template <class T, class T2>
T mmin(T a, T2 b) {
  return a < b ? a : b;
}
template <class T, class T2>
T mmax(T a, T2 b) {
  return a > b ? a : b;
}
template <class T>
T aabs(T a) {
  return a < 0 ? -a : a;
}
template <class T>
int dcmp(T a, T b) {
  return a > b;
}
template <int *a>
int cmp_a(int first, int second) {
  return a[first] < a[second];
}
struct __INIT__ {
  __INIT__() { memset(&inf, 0x3f, sizeof(inf)); }
} __INIT___;
namespace io {
const int SIZE = (1 << 21) + 1;
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c,
                                       qu[55];
int f, qr;
inline void flush() {
  fwrite(obuf, 1, oS - obuf, stdout);
  oS = obuf;
}
inline void putc(char first) {
  *oS++ = first;
  if (oS == oT) flush();
}
template <typename A>
inline bool read(A &first) {
  for (f = 1, c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                              (iS == iT ? EOF : *iS++))
                            : *iS++);
       c < '0' || c > '9';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    if (c == '-')
      f = -1;
    else if (c == EOF)
      return 0;
  for (first = 0; c <= '9' && c >= '0';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    first = first * 10 + (c & 15);
  first *= f;
  return 1;
}
inline bool read(char &first) {
  while ((first = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                               (iS == iT ? EOF : *iS++))
                            : *iS++)) == ' ' ||
         first == '\n' || first == '\r')
    ;
  return first != EOF;
}
inline bool read(char *first) {
  while ((*first = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                                (iS == iT ? EOF : *iS++))
                             : *iS++)) == '\n' ||
         *first == ' ' || *first == '\r')
    ;
  if (*first == EOF) return 0;
  while (!(*first == '\n' || *first == ' ' || *first == '\r' || *first == EOF))
    *(++first) = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                              (iS == iT ? EOF : *iS++))
                           : *iS++);
  *first = 0;
  return 1;
}
template <typename A, typename... B>
inline bool read(A &first, B &...second) {
  return read(first) && read(second...);
}
template <typename A>
inline bool write(A first) {
  if (!first) putc('0');
  if (first < 0) putc('-'), first = -first;
  while (first) qu[++qr] = first % 10 + '0', first /= 10;
  while (qr) putc(qu[qr--]);
  return 0;
}
inline bool write(char first) {
  putc(first);
  return 0;
}
inline bool write(const char *first) {
  while (*first) {
    putc(*first);
    ++first;
  }
  return 0;
}
inline bool write(char *first) {
  while (*first) {
    putc(*first);
    ++first;
  }
  return 0;
}
template <typename A, typename... B>
inline bool write(A first, B... second) {
  return write(first) || write(second...);
}
struct Flusher_ {
  ~Flusher_() { flush(); }
} io_flusher_;
}  // namespace io
using io ::putc;
using io ::read;
using io ::write;
int l[200005], r[200005];
vector<pair<int, int> > to[200005];
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    pq;
int n;
int a[200005], ins[400005], ym[200005];
int stk[400005], t, vis[400005];
set<int> ya, yb;
int w[400005];
void find_cir(int first, int second) {
  write("NO\n");
  for (int i = 1; i <= n; ++i) write(a[i], i == n ? '\n' : ' ');
  stk[++t] = second;
  int m;
  for (int i = t; i; --i)
    if (stk[i] == first) {
      for (int j = i; j <= t; ++j) w[j - i] = stk[j];
      m = t - i + 1;
    }
  for (int i = 0; i < m; ++i)
    if (w[i] <= n) {
      a[w[i]] ^= (w[(i + 1) % m] - n) ^ (w[(i + m - 1) % m] - n);
    }
  for (int i = 1; i <= n; ++i) write(a[i], i == n ? '\n' : ' ');
  exit(0);
}
void dfs(int first) {
  if (first <= n) {
    auto it = yb.lower_bound(l[first]);
    while (it != yb.end() && *it <= r[first]) {
      if (*it == a[first]) {
        ++it;
      } else {
        find_cir(*it + n, first);
      }
    }
    vis[first] = 1;
    ins[first] = 1;
    stk[++t] = first;
    while (1) {
      it = ya.lower_bound(l[first]);
      if (it != ya.end() && *it == a[first]) ++it;
      if (it != ya.end() && *it <= r[first])
        dfs(*it + n);
      else
        break;
    }
    ins[first] = 0;
    --t;
  } else {
    if (ins[ym[first - n]]) {
      find_cir(ym[first - n], first);
    } else {
      stk[++t] = first;
      ins[first] = 1;
      vis[first] = 1;
      ya.erase(first - n);
      yb.insert(first - n);
      dfs(ym[first - n]);
      yb.erase(first - n);
      ins[first] = 0;
      --t;
    }
  }
}
signed main() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(l[i], r[i]);
    to[l[i]].push_back(make_pair(r[i], i));
  }
  for (int i = 1; i <= n; ++i) {
    for (auto j : to[i]) pq.push(j);
    a[pq.top().second] = i;
    ym[i] = pq.top().second;
    pq.pop();
  }
  for (int i = 1; i <= n; ++i) ya.insert(i);
  for (int i = 1; i <= n; ++i)
    if (!vis[i]) dfs(i);
  write("YES\n");
  for (int i = 1; i <= n; ++i) write(a[i], i == n ? '\n' : ' ');
  return 0;
}