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;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
const int inf = 1e9;
const int maxn = 1e6 + 5;
struct segtree {
  pair<int, int> merge(pair<int, int> x, pair<int, int> y) { return min(x, y); }
  int n;
  vector<pair<int, int>> t;
  void init(int n) {
    n += 10;
    this->n = n;
    t.resize(n * 4, {inf, inf});
  }
  void upd(int v, int tl, int tr, int i, pair<int, int> val) {
    if (tl == tr) {
      t[v] = val;
    } else {
      int tm = (tl + tr) / 2;
      if (i <= tm) {
        upd(2 * v, tl, tm, i, val);
      } else {
        upd(2 * v + 1, tm + 1, tr, i, val);
      }
      t[v] = merge(t[2 * v], t[2 * v + 1]);
    }
  }
  pair<int, int> qry(int v, int tl, int tr, int l, int r) {
    if (l > tr || r < tl) {
      return {inf, inf};
    }
    if (l <= tl && tr <= r) {
      return t[v];
    }
    int tm = (tl + tr) / 2;
    return merge(qry(2 * v, tl, tm, l, r), qry(2 * v + 1, tm + 1, tr, l, r));
  }
};
int n;
pair<int, int> iv[maxn];
int assigned[maxn];
vector<pair<int, int>> s[maxn];
int ans[maxn];
void print_ans() {
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> iv[i].first >> iv[i].second;
    s[iv[i].first].push_back({iv[i].second, i});
  }
  set<pair<int, int>> act;
  for (int i = 1; i <= n; i++) {
    act.insert(s[i].begin(), s[i].end());
    auto cur = *act.begin();
    act.erase(act.begin());
    assigned[i] = cur.second;
    ans[cur.second] = i;
  }
  segtree t;
  t.init(n + 10);
  for (int i = 1; i <= n; i++) {
    int idx = assigned[i];
    t.upd(1, 1, n, i, make_pair(iv[idx].first, idx));
  }
  for (int i = 1; i <= n; i++) {
    int idx = assigned[i];
    int R = iv[idx].second;
    auto cur = t.qry(1, 1, n, i + 1, R);
    if (cur.first == inf) {
      continue;
    }
    if (iv[cur.second].first <= i) {
      cout << "NO\n";
      print_ans();
      swap(ans[idx], ans[cur.second]);
      print_ans();
      exit(0);
    }
  }
  cout << "YES\n";
  print_ans();
  return 0;
}