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;
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int inf = (1 << 30) - 1;
const ll INF = (1LL << 60) - 1;
template <typename T>
bool chmax(T &x, const T &y) {
  return (x < y) ? (x = y, true) : false;
};
template <typename T>
bool chmin(T &x, const T &y) {
  return (x > y) ? (x = y, true) : false;
};
struct io_setup {
  io_setup() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(15);
  }
} io_setup;
template <typename Monoid>
struct Segment_Tree {
  using F = function<Monoid(Monoid, Monoid)>;
  int n;
  vector<Monoid> seg;
  const F f;
  const Monoid e1;
  Segment_Tree(const vector<Monoid> &v, const F &f, const Monoid &e1)
      : f(f), e1(e1) {
    int m = (int)v.size();
    n = 1;
    while (n < m) n <<= 1;
    seg.assign(2 * n, e1);
    copy(v.begin(), v.end(), seg.begin() + n);
    for (int i = n - 1; i > 0; i--) seg[i] = f(seg[2 * i], seg[2 * i + 1]);
  }
  void change(int i, const Monoid &x) {
    seg[i += n] = x;
    while (i >>= 1) {
      seg[i] = f(seg[2 * i], seg[2 * i + 1]);
    }
  }
  Monoid query(int l, int r) const {
    Monoid L = e1, R = e1;
    l += n, r += n;
    while (l < r) {
      if (l & 1) L = f(L, seg[l++]);
      if (r & 1) R = f(seg[--r], R);
      l >>= 1, r >>= 1;
    }
    return f(L, R);
  }
  Monoid operator[](int i) const { return seg[n + i]; }
  template <typename C>
  int find_subtree(int i, const C &check, const Monoid &x, Monoid &M,
                   bool type) const {
    while (i < n) {
      Monoid nxt = type ? f(seg[2 * i + type], M) : f(M, seg[2 * i + type]);
      if (check(nxt, x))
        i = 2 * i + type;
      else
        M = nxt, i = 2 * i + (type ^ 1);
    }
    return i - n;
  }
  template <typename C>
  int find_first(int l, const C &check, const Monoid &x) const {
    Monoid L = e1;
    int a = l + n, b = n + n;
    while (a < b) {
      if (a & 1) {
        Monoid nxt = f(L, seg[a]);
        if (check(nxt, x)) return find_subtree(a, check, x, L, false);
        L = nxt, a++;
      }
      a >>= 1, b >>= 1;
    }
    return n;
  }
  template <typename C>
  int find_last(int r, const C &check, const Monoid &x) const {
    Monoid R = e1;
    int a = n, b = r + n;
    while (a < b) {
      if (b & 1 || a == 1) {
        Monoid nxt = f(seg[--b], R);
        if (check(nxt, x)) return find_subtree(b, check, x, R, true);
        R = nxt;
      }
      a >>= 1, b >>= 1;
    }
    return -1;
  }
};
int main() {
  int N;
  cin >> N;
  vector<int> a(N), b(N);
  vector<vector<int>> ids(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    ids[a[i]].emplace_back(i);
  }
  vector<int> ans(N), p(N);
  priority_queue<pii, vector<pii>, greater<pii>> que;
  for (int i = 0; i < N; i++) {
    for (auto &e : ids[i]) {
      que.emplace(b[e], e);
    }
    ans[que.top().second] = i;
    que.pop();
  }
  for (int i = 0; i < N; i++) p[ans[i]] = i;
  auto f = [](int a, int b) { return min(a, b); };
  vector<int> v(N);
  for (int i = 0; i < N; i++) v[i] = a[p[i]];
  Segment_Tree<int> seg(v, f, inf);
  for (int i = 0; i < N; i++) {
    int L = i + 1, R = b[p[i]] + 1;
    if (seg.query(L, R) <= i) {
      for (int j = L; j <= R - 1; j++) {
        if (a[p[j]] <= i) {
          cout << "NO\n";
          for (auto &e : ans) cout << e + 1 << ' ';
          cout << '\n';
          swap(ans[p[i]], ans[p[j]]);
          for (auto &e : ans) cout << e + 1 << ' ';
          cout << '\n';
          return 0;
        }
      }
    }
  }
  cout << "YES\n";
  for (auto &e : ans) cout << e + 1 << ' ';
  cout << '\n';
}