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;
template <typename elemType>
inline void Read(elemType &T) {
  elemType X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  T = (w ? -X : X);
}
multiset<pair<int, int> > S;
struct Node {
  int a, b, ID;
};
struct SegTreeNode {
  int val, ID;
};
Node Data[200010];
int Pos[200010], List[200010], a[200010], b[200010];
SegTreeNode SegTree[800010];
int N;
bool cmp(Node A, Node B) { return A.a < B.a; }
void Build_SegTree(int Root, int L, int R) {
  if (L == R) {
    SegTree[Root].val = a[Pos[L]];
    SegTree[Root].ID = L;
    return;
  }
  int mid = (L + R) >> 1;
  Build_SegTree(Root << 1, L, mid);
  Build_SegTree(Root << 1 | 1, mid + 1, R);
  int ls = SegTree[Root << 1].ID, rs = SegTree[Root << 1 | 1].ID;
  if (SegTree[Root << 1].val < SegTree[Root << 1 | 1].val) {
    SegTree[Root].val = SegTree[Root << 1].val;
    SegTree[Root].ID = ls;
  } else {
    SegTree[Root].val = SegTree[Root << 1 | 1].val;
    SegTree[Root].ID = rs;
  }
  return;
}
pair<int, int> Query(int Root, int L, int R, int QL, int QR) {
  if (R < QL || QR < L) return make_pair(2147483647, 0);
  if (QL <= L && R <= QR) return make_pair(SegTree[Root].val, SegTree[Root].ID);
  int mid = (L + R) >> 1;
  auto ls = Query(Root << 1, L, mid, QL, QR);
  auto rs = Query(Root << 1 | 1, mid + 1, R, QL, QR);
  if (ls.first < rs.first) return ls;
  return rs;
}
int main() {
  Read(N);
  for (register int i = 1; i <= N; ++i) {
    Read(Data[i].a);
    Read(Data[i].b);
    a[i] = Data[i].a;
    b[i] = Data[i].b;
    Data[i].ID = i;
  }
  a[0] = 2147483647;
  sort(Data + 1, Data + N + 1, cmp);
  int p = 0;
  for (register int i = 1; i <= N; ++i) {
    while (p + 1 <= N && Data[p + 1].a <= i) {
      ++p;
      S.insert(make_pair(Data[p].b, Data[p].ID));
    }
    Pos[i] = S.begin()->second;
    S.erase(S.begin());
  }
  for (register int i = 1; i <= N; ++i) List[Pos[i]] = i;
  Build_SegTree(1, 1, N);
  bool flag = false;
  int u, v;
  for (register int i = 1; i <= N; ++i) {
    if (i + 1 > b[Pos[i]]) continue;
    auto tmp = Query(1, 1, N, i + 1, b[Pos[i]]);
    if (tmp.first <= i) {
      flag = true;
      u = Pos[tmp.second], v = Pos[i];
      break;
    }
  }
  if (!flag) {
    printf("YES\n");
    for (register int i = 1; i <= N; ++i) printf("%d ", List[i]);
    printf("\n");
    return 0;
  }
  printf("NO\n");
  for (register int i = 1; i <= N; ++i) printf("%d ", List[i]);
  printf("\n");
  swap(List[u], List[v]);
  for (register int i = 1; i <= N; ++i) printf("%d ", List[i]);
  printf("\n");
  return 0;
}