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;
long long P = 7340033;
const int arrn = 2e5 + 1;
template <typename T>
class segtree {
 private:
  int N;
  T lambda(T a, T b) { return min(a, b); }
  T rseg(int l, int r, int i, int lt, int rt) {
    if (l == lt && r == rt)
      return tree[i];
    else {
      int m = (lt + rt) >> 1;
      if (m < r && m >= l)
        return lambda(rseg(l, m, i << 1, lt, m),
                      rseg(m + 1, r, ((i << 1) | 1), m + 1, rt));
      else if (r <= m)
        return rseg(l, r, i << 1, lt, m);
      else if (l > m)
        return rseg(l, r, ((i << 1) | 1), m + 1, rt);
      else
        assert(false);
    }
  }
  void upseg(int index, T val, int i, int l, int r) {
    if (l == r)
      tree[i] = val;
    else {
      int m = (l + r) >> 1;
      if (index <= m)
        upseg(index, val, i << 1, l, m);
      else if (index > m)
        upseg(index, val, ((i << 1) | 1), m + 1, r);
      tree[i] = lambda(tree[i << 1], tree[((i << 1) | 1)]);
    }
  }
  void preseg(int i, int l, int r, const vector<T> &in) {
    if (l == r)
      tree[i] = in[l];
    else {
      int m = (l + r) >> 1;
      preseg(i << 1, l, m, in);
      preseg(((i << 1) | 1), m + 1, r, in);
      tree[i] = lambda(tree[i << 1], tree[((i << 1) | 1)]);
    }
  }

 public:
  vector<T> tree;
  segtree(int siz) {
    N = siz;
    tree.resize(4 * N);
  }
  segtree(const vector<T> &in) {
    N = in.size();
    tree.resize(4 * N);
    preseg(1, 0, N - 1, in);
  }
  T rng(int l, int r) { return rseg(l, r, 1, 0, N - 1); }
  void upd(int ind, T val) { upseg(ind, val, 1, 0, N - 1); }
};
void solve() {
  int n;
  cin >> n;
  vector<pair<pair<int, int>, int>> tem(n);
  for (int i = 0; i < n; i++) {
    cin >> tem[i].first.first >> tem[i].first.second;
    tem[i].first.first--;
    tem[i].first.second--;
    tem[i].second = i;
  }
  sort(tem.begin(), tem.end());
  vector<pair<int, int>> inter(n);
  vector<int> aind(n);
  for (int i = 0; i < n; i++) {
    inter[i] = tem[i].first;
    aind[i] = tem[i].second;
  }
  set<pair<pair<int, int>, int>> proc;
  int ind = 0;
  vector<int> lo(n, -1), hi(n, -1), ans1(n, -1), ans2;
  for (int i = 0; i < n; i++) {
    while (ind < n && inter[ind].first <= i) {
      proc.insert(
          make_pair(make_pair(inter[ind].second, inter[ind].first), aind[ind]));
      ind++;
    }
    auto it = proc.begin();
    assert(it->first.first >= i);
    lo[i] = it->first.second;
    hi[i] = it->first.first;
    ans1[it->second] = i;
    proc.erase(it);
  }
  segtree<pair<int, int>> tree(n);
  for (int i = 0; i < n; i++) {
    tree.upd(i, make_pair(lo[i], i));
  }
  ans2 = ans1;
  bool chk = 0;
  for (int i = 0; i < n; i++) {
    int l = i + 1, r = hi[i];
    if (l > r) continue;
    auto tem = tree.rng(l, r);
    if (tem.first <= i) {
      int u = -1, v = -1;
      for (int j = 0; j < n; j++) {
        if (ans2[j] == i) u = j;
        if (ans2[j] == tem.second) v = j;
      }
      swap(ans2[u], ans2[v]);
      chk = 1;
      break;
    }
  }
  if (!chk) {
    cout << "YES\n";
    for (int i = 0; i < n; i++) cout << ans1[i] + 1 << ' ';
    return;
  }
  cout << "NO\n";
  for (int i = 0; i < n; i++) cout << ans1[i] + 1 << ' ';
  cout << '\n';
  for (int i = 0; i < n; i++) cout << ans2[i] + 1 << ' ';
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int T = 1;
  for (int c = 0; c < T; c++) {
    solve();
  }
}