#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e6 + 5;
int ans1, ans2;
int l[MAXN];
int r[MAXN];
int res[MAXN];
int pos[MAXN];
int n;
vector<int> v2;
priority_queue<pair<int, int>> q1;
vector<pair<pair<int, int>, int>> v1;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    v1.push_back(make_pair(make_pair(l[i], r[i]), i));
  }
  sort(v1.begin(), v1.end());
  int ind = 0;
  for (int i = 1; i <= n; i++) {
    while (ind < n && v1[ind].first.first <= i) {
      q1.push(make_pair(-v1[ind].first.second, v1[ind].second));
      ind++;
    }
    res[i] = q1.top().second;
    q1.pop();
  }
  for (int i = 1; i <= n; i++) {
    while (v2.size() && r[res[v2.back()]] < i) {
      v2.pop_back();
    }
    int currl = l[res[i]];
    int currr = r[res[i]];
    if (v2.size() && currl <= v2.back()) {
      ans1 = i;
      ans2 = v2.back();
    }
    while (v2.size() && currr >= r[res[v2.back()]]) {
      v2.pop_back();
    }
    v2.push_back(i);
  }
  if (ans1) {
    cout << "NO" << endl;
    ;
    for (int i = 1; i <= n; i++) {
      pos[res[i]] = i;
    }
    for (int i = 1; i <= n; i++) {
      cout << pos[i] << " ";
    }
    cout << endl;
    for (int i = 1; i <= n; i++) {
      if (i == ans1) {
        pos[res[ans2]] = i;
      } else if (i == ans2) {
        pos[res[ans1]] = i;
      } else {
        pos[res[i]] = i;
      }
    }
    for (int i = 1; i <= n; i++) {
      cout << pos[i] << " ";
    }
  } else {
    cout << "YES" << endl;
    for (int i = 1; i <= n; i++) {
      pos[res[i]] = i;
    }
    for (int i = 1; i <= n; i++) {
      cout << pos[i] << " ";
    }
    cout << endl;
  }
}
