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 ii = pair<int, int>;
using vi = vector<int>;
const int N = 2e5 + 5;
int n, l[N], r[N], atob[N], btoa[N];
vector<ii> ops[N], rng[N];
set<int> unvis, stk;
int par[N];
int anc = -1, des = -1;
void dfs(int a, int dad = -1) {
  par[a] = dad;
  unvis.erase(a);
  stk.insert(a);
  int b = atob[a];
  for (auto &[x, y] : rng[b]) {
    auto tmp = stk.lower_bound(x);
    if (tmp != stk.end() && *tmp <= y) {
      anc = *tmp, des = b;
      return;
    }
    for (auto it = unvis.lower_bound(x); it != unvis.end() && *it <= y;) {
      int i = *it;
      dfs(i, b);
      if (~anc) return;
      it = unvis.lower_bound(i + 1);
    }
  }
  stk.erase(a);
}
int main(int argc, char const *argv[]) {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d", l + i, r + i);
    ops[l[i]].emplace_back(i, +1);
    ops[r[i] + 1].emplace_back(i, -1);
  }
  set<ii> bag;
  for (int i = 1; i <= n; ++i) {
    for (ii &o : ops[i]) {
      int j = o.first;
      if (o.second == -1) {
        bag.erase(ii(r[j], j));
      } else {
        bag.insert(ii(r[j], j));
      }
    }
    atob[i] = bag.begin()->second;
    bag.erase(bag.begin());
  }
  for (int i = 1; i <= n; ++i) {
    btoa[atob[i]] = i;
  }
  for (int i = 1; i <= n; ++i) {
    int &m = btoa[i];
    if (l[i] <= m - 1) rng[i].emplace_back(l[i], m - 1);
    if (m + 1 <= r[i]) rng[i].emplace_back(m + 1, r[i]);
  }
  for (int i = 1; i <= n; ++i) unvis.insert(i);
  for (int i = 1; i <= n; ++i) {
    if (unvis.count(i)) {
      dfs(i);
      if (~anc) break;
    }
  }
  if (!~anc) {
    puts("YES");
    for (int i = 1; i <= n; ++i) {
      printf("%d%c", btoa[i], " \n"[i == n]);
    }
    return 0;
  }
  puts("NO");
  for (int i = 1; i <= n; ++i) {
    printf("%d%c", btoa[i], " \n"[i == n]);
  }
  int cura = btoa[des];
  int curb = par[cura];
  while (cura != anc) {
    int nxta = btoa[curb];
    int nxtb = par[nxta];
    atob[cura] = curb;
    btoa[curb] = cura;
    cura = nxta;
    curb = nxtb;
  }
  btoa[des] = anc;
  atob[anc] = des;
  for (int i = 1; i <= n; ++i) {
    printf("%d%c", btoa[i], " \n"[i == n]);
  }
  return 0;
}