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 maxn = 2e5 + 7;
priority_queue<pair<int, int> > Q;
int id[maxn], reid[maxn];
int idtonum[maxn];
int lef[maxn], rght[maxn];
struct node {
  int l, r, id;
} Node[maxn];
bool cmp(node a, node b) {
  if (a.l == b.l) return a.r < b.r;
  return a.l < b.l;
}
queue<int> output;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &Node[i].l, &Node[i].r), Node[i].id = i, lef[i] = Node[i].l,
                                           rght[i] = Node[i].r;
  sort(Node + 1, Node + 1 + n, cmp);
  int pos = 1;
  for (int i = 1; i <= n; i++) {
    while (Node[pos].l == i) {
      Q.push(make_pair(-Node[pos].r, Node[pos].id));
      pos++;
    }
    int fval, sval;
    fval = -Q.top().first;
    sval = Q.top().second;
    Q.pop();
    id[sval] = i;
    reid[i] = sval;
    idtonum[sval] = i;
  }
  for (int i = 1; i <= n; i++) output.push(id[i]);
  bool flag = true;
  for (int i = 1; i < n; i++) {
    int numrgh = rght[reid[i]];
    int numlef = lef[reid[i + 1]];
    if (i >= numlef && i + 1 <= numrgh) {
      swap(id[reid[i]], id[reid[i + 1]]);
      flag = false;
      break;
    }
  }
  if (flag) {
    sort(Node + 1, Node + 1 + n, cmp);
    for (int i = 1; i < n; i++) {
      int numrgh = min(Node[i].r, Node[i + 1].r);
      int numlef = max(Node[i + 1].l, Node[i].l);
      int idfst = id[Node[i].id], idscd = id[Node[i + 1].id];
      if (numlef < numrgh && idfst >= numlef && idfst <= numrgh &&
          idscd >= numlef && idscd <= numrgh) {
        swap(id[Node[i].id], id[Node[i + 1].id]);
        flag = false;
        break;
      }
    }
  }
  if (flag) {
    cout << "YES" << endl;
    int outputflag = false;
    while (!output.empty()) {
      if (outputflag) cout << " ";
      outputflag = true;
      cout << output.front();
      output.pop();
    }
    cout << endl;
  } else {
    cout << "NO" << endl;
    int outputflag = false;
    while (!output.empty()) {
      if (outputflag) cout << " ";
      outputflag = true;
      cout << output.front();
      output.pop();
    }
    cout << endl;
    for (int i = 1; i <= n; i++) {
      if (i != 1) cout << " ";
      cout << id[i];
    }
    cout << endl;
  }
  return 0;
}