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 <class T1, class T2>
ostream &operator<<(ostream &os, pair<T1, T2> &p);
template <class T>
ostream &operator<<(ostream &os, vector<T> &v);
template <class T>
ostream &operator<<(ostream &os, set<T> &v);
template <class T1, class T2>
ostream &operator<<(ostream &os, map<T1, T2> &v);
const long long mod = 1e9 + 7;
const int N = 2e5 + 5;
void Print(vector<int> &v) {
  for (int i = 0; i < v.size(); i++) {
    printf("%d ", v[i]);
  }
  printf("\n");
}
bool check(pair<int, int> a, pair<int, int> b, int ans1, int ans2) {
  return ans1 >= b.first && ans1 <= b.second && ans2 >= a.first &&
         ans2 <= a.second;
}
vector<int> ans;
bool comp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return ans[a.second] < ans[b.second];
}
void TEST_CASES(int cas) {
  int n;
  scanf("%d", &n);
  ans.resize(n);
  vector<pair<pair<int, int>, int> > v(n);
  vector<multiset<pair<int, int> > > st(n + 1);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &v[i].first.first, &v[i].first.second);
    v[i].second = i;
    st[v[i].first.first].insert({v[i].first.second, v[i].second});
  }
  priority_queue<pair<int, int> > pq;
  for (int i = 1; i <= n; i++) {
    for (auto it : st[i]) {
      pq.push({-it.first, it.second});
    }
    pair<int, int> p = pq.top();
    pq.pop();
    ans[p.second] = i;
  }
  sort(v.begin(), v.end(), comp);
  for (int i = 0; i < n - 1; i++) {
    if (check(v[i].first, v[i + 1].first, ans[v[i].second],
              ans[v[i + 1].second])) {
      printf("NO\n");
      Print(ans);
      swap(ans[v[i].second], ans[v[i + 1].second]);
      Print(ans);
      return;
    }
  }
  if (0 != n - 1 && check(v[0].first, v[n - 1].first, ans[v[0].second],
                          ans[v[n - 1].second])) {
    printf("NO\n");
    Print(ans);
    swap(ans[v[0].second], ans[v[n - 1].second]);
    Print(ans);
    return;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n - 1; i++) {
    if (check(v[i].first, v[i + 1].first, ans[v[i].second],
              ans[v[i + 1].second])) {
      printf("NO\n");
      Print(ans);
      swap(ans[v[i].second], ans[v[i + 1].second]);
      Print(ans);
      return;
    }
  }
  printf("YES\n");
  Print(ans);
}
int main() {
  int t = 1, cas = 0;
  while (t--) {
    TEST_CASES(++cas);
  }
  return 0;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, pair<T1, T2> &p) {
  os << "{" << p.first << ", " << p.second << "} ";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "[ ";
  for (int i = 0; i < v.size(); i++) {
    os << v[i] << " ";
  }
  os << " ]";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, set<T> &v) {
  os << "[ ";
  for (T i : v) {
    os << i << " ";
  }
  os << " ]";
  return os;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, map<T1, T2> &v) {
  for (auto i : v) {
    os << "Key : " << i.first << " , Value : " << i.second << endl;
  }
  return os;
}