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 INFF = 1000000000000000005LL;
int n;
vector<pair<long long, int>> arr;
struct segtree {
  vector<pair<long long, int>> tree, lazy;
  segtree(int size) {
    lazy = tree = vector<pair<long long, int>>(4 * size);
    for (int i = 0; i < 4 * size; i++) lazy[i].first = 0, tree[i].second = i;
  }
  void construct(int l = 0, int r = n - 1, int node = 1) {
    if (l == r) {
      tree[node] = arr[l];
      return;
    }
    int mid = (l + r) / 2;
    construct(l, mid, 2 * node);
    construct(mid + 1, r, 2 * node + 1);
    tree[node] = min(tree[2 * node], tree[2 * node + 1]);
  }
  pair<long long, int> minquery(int ql, int qr, int l = 0, int r = n - 1,
                                int node = 1) {
    if (qr < 0) return {-1, -1};
    if (ql >= n) return {-1, -1};
    if (ql > qr) return {-1, -1};
    if (lazy[node].first) {
      tree[node].first += lazy[node].first;
      if (l != r) {
        lazy[2 * node].first += lazy[node].first;
        lazy[2 * node + 1].first += lazy[node].first;
      }
      lazy[node].first = 0;
    }
    if (l > r || l > qr || ql > r) return {INFF, -1};
    if (ql <= l && qr >= r) return {tree[node].first, tree[node].second};
    int mid = (l + r) / 2;
    return min(minquery(ql, qr, l, mid, 2 * node),
               minquery(ql, qr, mid + 1, r, 2 * node + 1));
  }
  void display() {
    for (auto u : tree) {
      cout << u.first << " ";
    }
    cout << "\n";
    for (auto u : tree) {
      cout << u.second << " ";
    }
    cout << "\n";
  }
};
void solve(vector<int> &ans, vector<pair<int, int>> &mem) {
  deque<pair<pair<int, int>, int>> v;
  for (int i = 0; i < n; i++) v.push_back({{mem[i].first, mem[i].second}, i});
  sort(v.begin(), v.end());
  multiset<pair<int, int>> mst;
  for (int i = 0; i < n; i++) {
    while ((int)v.size() > 0 && v[0].first.first <= i) {
      mst.insert({v[0].first.second, v[0].second});
      v.pop_front();
    }
    ans[mst.begin()->second] = i + 1;
    mst.erase(mst.find(*mst.begin()));
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> n;
  segtree st(n);
  vector<int> ans(n), ch(n);
  vector<pair<int, int>> range(n);
  vector<pair<int, int>> mem(n);
  arr.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> mem[i].first >> mem[i].second;
    mem[i].first--, mem[i].second--;
  }
  solve(ans, mem);
  for (int i = 0; i < n; i++) {
    ch[ans[i] - 1] = i;
    arr[ans[i] - 1] = {mem[i].first, i};
  }
  st.construct();
  for (int i = 0; i < n; i++) {
    pair<long long, int> a = st.minquery(i + 1, mem[ch[i]].second);
    if (a.first == -1) continue;
    if (a.first <= i) {
      cout << "NO\n";
      for (auto u : ans) cout << u << " ";
      cout << "\n";
      swap(ans[ch[i]], ans[a.second]);
      for (auto u : ans) cout << u << " ";
      return 0;
    }
  }
  cout << "YES\n";
  for (auto u : ans) cout << u << " ";
  return 0;
}