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 N = 2e5 + 3;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
pair<int, int> t[N * 4];
void upd(int v, int l, int r, int pos, int val) {
  if (l == r) {
    t[v] = make_pair(val, l);
    return;
  }
  int mid = (l + r) / 2;
  if (pos <= mid)
    upd(v * 2, l, mid, pos, val);
  else
    upd(v * 2 + 1, mid + 1, r, pos, val);
  t[v] = max(t[v * 2], t[v * 2 + 1]);
}
pair<int, int> get(int v, int l, int r, int L, int R) {
  if (l > r || L > r || l > R) return make_pair(0, 0);
  if (L <= l && r <= R) return t[v];
  int mid = (l + r) / 2;
  return max(get(v * 2, l, mid, L, R), get(v * 2 + 1, mid + 1, r, L, R));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  pair<pair<int, int>, int> p[n + 4];
  for (int i = 1; i <= n; ++i) {
    int l, r;
    cin >> l >> r;
    p[i].first.first = r, p[i].first.second = l;
    p[i].second = i;
  }
  sort(p + 1, p + 1 + n);
  set<int> s;
  for (int i = 1; i <= n; ++i) s.insert(i);
  int a[n + 4], pos[n + 4];
  vector<pair<int, int> > L[n + 4];
  for (int i = 1; i <= n; ++i) {
    int id = p[i].second;
    int l = p[i].first.second, r = p[i].first.first;
    a[id] = *s.lower_bound(l);
    s.erase(a[id]);
    L[l].push_back(make_pair(a[id], r));
    pos[a[id]] = i;
  }
  int x = -1, y = -1;
  int last = 0;
  for (int i = 1; i <= n; ++i) {
    int id = p[pos[i]].second;
    int l = p[pos[i]].first.second, r = p[pos[i]].first.first;
    for (auto it : L[i]) upd(1, 1, n, it.first, it.second);
    pair<int, int> rr = get(1, 1, n, l, r);
    if (a[id] <= rr.first && rr.second != a[id]) {
      x = a[id], y = rr.second;
    }
  }
  if (x != -1 && y != -1) {
    cout << "NO\n";
    for (int i = 1; i <= n; ++i) cout << a[i] << ' ';
    cout << "\n";
    for (int i = 1; i <= n; ++i) {
      if (a[i] == x)
        cout << y << ' ';
      else if (a[i] == y)
        cout << x << ' ';
      else
        cout << a[i] << ' ';
    }
  } else {
    cout << "YES\n";
    for (int i = 1; i <= n; ++i) cout << a[i] << ' ';
  }
  return 0;
}