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;
const int MOD = 998244353;
const int N = 2e5 + 5;
tuple<int, int, int> P[N];
int tree[N * 4];
int delay[N * 4];
void push(int node) {
  if (delay[node] == 0) return;
  delay[2 * node + 1] += delay[node];
  tree[2 * node + 1] += delay[node];
  delay[2 * node + 2] += delay[node];
  tree[2 * node + 2] += delay[node];
  delay[node] = 0;
}
void add(int node, int ts, int te, int s, int e, int d) {
  if (s > te || e < ts || s > e) return;
  if (s <= ts && e >= te) {
    delay[node] += d;
    tree[node] += d;
    return;
  }
  push(node);
  int m = (ts + te) / 2;
  add(node * 2 + 1, ts, m, s, e, d);
  add(node * 2 + 2, m + 1, te, s, e, d);
  tree[node] = min(tree[2 * node + 1], tree[2 * node + 2]);
}
int query(int node, int ts, int te, int s, int e) {
  if (s > te || e < ts || s > e) return INT_MAX;
  if (s <= ts && e >= te) {
    return tree[node];
  }
  push(node);
  int m = (ts + te) / 2;
  int l1 = query(node * 2 + 1, ts, m, s, e);
  int l2 = query(node * 2 + 2, m + 1, te, s, e);
  return min(l1, l2);
}
void output(vector<int> &res, int n) {
  vector<int> a(n);
  for (int i = 0; i < res.size(); i++) {
    a[res[i]] = i + 1;
  }
  for (int i = 0; i < n; i++) {
    if (i != 0) cout << " ";
    cout << a[i];
  }
  cout << "\n";
}
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    P[i] = {a - 1, b - 1, i};
  }
  sort(P, P + n);
  int pos = 0;
  int p = 0;
  set<tuple<int, int, int>> ss;
  vector<int> res;
  while (pos < n) {
    while (p < n && get<0>(P[p]) <= pos) {
      ss.insert({get<1>(P[p]), get<2>(P[p]), get<0>(P[p])});
      p++;
    }
    int l, r, idx;
    tie(r, idx, l) = *ss.begin();
    res.push_back(idx);
    ss.erase(ss.begin());
    pos++;
  }
  vector<int> res2 = res;
  bool hasT = false;
  ss.clear();
  set<int> sa;
  vector<int> idxToP(n);
  for (int i = 0; i < n; i++) {
    idxToP[get<2>(P[i])] = i;
  };
  for (int i = 0; i < n; i++) {
    int p = idxToP[res[i]];
    if (ss.size() > 0)
      ;
    while (ss.size() > 0 && get<0>(*ss.begin()) < i) {
      int t1 = get<2>(*ss.begin());
      ;
      sa.erase(t1);
      ss.erase(ss.begin());
    }
    if (sa.size() > 0 && *sa.rbegin() >= get<0>(P[p])) {
      hasT = true;
      int l = *sa.rbegin();
      swap(res2[i], res2[l]);
      break;
    } else {
      ss.insert({get<1>(P[p]), p, i});
      sa.insert(i);
    }
  }
  if (hasT) {
    ;
    ;
    cout << "NO\n";
    output(res, n);
    output(res2, n);
  } else {
    cout << "YES\n";
    output(res, n);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  int T = 1;
  for (int i = 1; i <= T; i++) {
    solve();
  }
  cout.flush();
  return 0;
}