#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7, mod = 1e9 + 7;
int n, l[N], r[N], ans[N], nxt[N];
vector<pair<int, int> > p[N];
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    pr;
void print() {
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    p[l[i]].push_back(make_pair(r[i], i));
  }
  for (int i = 1; i <= n; i++) {
    for (auto t : p[i]) {
      pr.push(t);
    }
    int now = pr.top().second;
    ans[now] = i;
    pr.pop();
    if (!pr.empty()) {
      nxt[now] = pr.top().second;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (nxt[i] == 0) continue;
    int nx = nxt[i];
    if (l[nx] <= ans[i] && r[nx] >= ans[i] && l[i] <= ans[nx] &&
        r[i] >= ans[nx]) {
      cout << "NO\n";
      print();
      swap(ans[i], ans[nx]);
      print();
      return 0;
    }
  }
  cout << "YES\n";
  print();
}
