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 ld = long double;
const ll MOD = 998244353;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const double PI = acos(-1);
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 200001;
pair<int, int> arr[mxN];
pair<pair<int, int>, int> nn[mxN];
int ans[mxN];
int rans[mxN];
int n;
int sgmin[2 * mxN];
int sgmax[2 * mxN];
void init() {
  for (int i = (n); i < (2 * n); ++i) {
    sgmin[i] = arr[rans[i - n]].first;
    sgmax[i] = arr[rans[i - n]].second;
  }
  for (int i = (n)-1; i >= (1); --i) {
    sgmin[i] = min(sgmin[i << 1], sgmin[i << 1 | 1]);
    sgmax[i] = max(sgmax[i << 1], sgmax[i << 1 | 1]);
  }
}
int qmax(int l, int r) {
  r++;
  int res = -1;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1) res = max(res, sgmax[l++]);
    if (r & 1) res = max(res, sgmax[--r]);
  }
  return res;
}
int qmin(int l, int r) {
  r++;
  int res = INF;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1) res = min(res, sgmin[l++]);
    if (r & 1) res = min(res, sgmin[--r]);
  }
  return res;
}
int main() {
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    cin >> arr[i].first >> arr[i].second;
    arr[i].first--;
    arr[i].second--;
    nn[i].first = arr[i];
    nn[i].second = i;
  }
  sort(nn, nn + n);
  int idx = 0;
  priority_queue<pair<int, int>, vector<pair<int, int>>,
                 greater<pair<int, int>>>
      pq;
  for (int i = (0); i < (n); ++i) {
    while (idx < n && nn[idx].first.first == i) {
      pq.push({nn[idx].first.second, nn[idx].second});
      idx++;
    }
    ans[pq.top().second] = i;
    rans[i] = pq.top().second;
    pq.pop();
  }
  pair<int, int> swp = {-1, -1};
  init();
  for (int i = (0); i < (n); ++i) {
    int l = arr[rans[i]].first;
    int r = arr[rans[i]].second;
    if (qmax(l, i - 1) >= i) {
      for (int j = (l); j < (i); ++j) {
        if (arr[rans[j]].second >= i) {
          swp = {rans[j], rans[i]};
          break;
        }
      }
      break;
    }
    if (qmin(i + 1, r) <= i) {
      for (int j = (i + 1); j < (r + 1); ++j) {
        if (arr[rans[j]].first <= i) {
          swp = {rans[j], rans[i]};
          break;
        }
      }
      break;
    }
  }
  if (swp.first == swp.second) {
    cout << "YES\n";
    for (int i = (0); i < (n); ++i) {
      cout << (ans[i] + 1) << " ";
    }
  } else {
    cout << "NO\n";
    for (int i = (0); i < (n); ++i) {
      cout << (ans[i] + 1) << " ";
    }
    cout << "\n";
    swap(ans[swp.first], ans[swp.second]);
    for (int i = (0); i < (n); ++i) {
      cout << (ans[i] + 1) << " ";
    }
  }
  return 0;
}