#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > vec[200005];
int pos[200005];
int ans1[200005], ans2[200005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    vec[a].push_back({b, i});
  }
  set<pair<int, int> > se;
  for (int i = 1; i <= n; i++) {
    for (pair<int, int> p : vec[i]) se.insert(p);
    pos[i] = se.begin()->second;
    se.erase(se.begin());
  }
  for (int i = 1; i <= n; i++) ans1[pos[i]] = i;
  for (int i = 1; i <= n; i++) ans2[i] = ans1[i];
  bool flag = true;
  for (int i = 1; i <= n; i++) {
    for (pair<int, int> p : vec[i]) se.insert(p);
    if (se.size() == 1) {
      se.erase(se.begin());
      continue;
    }
    auto it = se.begin();
    ++it;
    int j = it->second;
    if (ans1[j] <= se.begin()->first) {
      swap(ans2[pos[i]], ans2[j]);
      flag = false;
      break;
    }
    se.erase(se.begin());
  }
  printf("%s\n", flag ? "YES" : "NO");
  for (int i = 1; i <= n; i++) printf("%d ", ans1[i]);
  printf("\n");
  if (!flag) {
    for (int i = 1; i <= n; i++) printf("%d ", ans2[i]);
    printf("\n");
  }
  return 0;
}
