#include <bits/stdc++.h>
class Segtree {
 private:
  std::vector<int> t_;
  int n_;

 public:
  int Query(int n, int lft, int rgt, int rs, int re) {
    if (lft >= rs && rgt <= re) return t_[n];
    if (lft > re || rgt < rs) return 0;
    const int mid = (lft + rgt) / 2;
    return std::max(Query(2 * n, lft, mid, rs, re),
                    Query(2 * n + 1, mid + 1, rgt, rs, re));
  }
  void Set(int n, int lft, int rgt, int pt, int v) {
    if (lft == rgt) {
      t_[n] = v;
      return;
    }
    const int mid = (lft + rgt) / 2;
    if (pt <= mid) {
      Set(2 * n, lft, mid, pt, v);
    } else {
      Set(2 * n + 1, mid + 1, rgt, pt, v);
    }
    t_[n] = std::max(t_[2 * n], t_[2 * n + 1]);
  }
  Segtree(int n) : n_(n), t_(4 * n + 1) {}
};
template <typename T>
void print_vector(const std::vector<T>& v, int lo, int hi,
                  bool newline = true) {
  while (lo <= hi) {
    std::cout << v[lo++] << ' ';
  }
  if (newline) {
    std::cout << '\n';
  }
}
void Run() {
  int n;
  std::cin >> n;
  std::vector<std::array<int, 2>> inter(n);
  std::vector<std::vector<int>> start(n + 1);
  std::vector<int> greed(n + 1);
  std::vector<int> who(n + 1);
  for (int i = 0; i < n; ++i) {
    std::cin >> inter[i][0] >> inter[i][1];
    start[inter[i][0]].push_back(i);
  }
  std::set<std::pair<int, int>> by_end;
  for (int i = 1; i <= n; ++i) {
    for (int j : start[i]) {
      by_end.emplace(inter[j][1], j);
    }
    greed[by_end.begin()->second] = i;
    who[i] = by_end.begin()->second;
    by_end.erase(by_end.begin());
  }
  Segtree t(n + 1);
  for (int i = 1; i <= n; ++i) {
    std::array<int, 2> interval = inter[who[i]];
    if (t.Query(1, 0, n - 1, interval[0], i) >= i) {
      std::cout << "NO\n";
      print_vector(greed, 0, n - 1);
      for (int j = interval[0]; j <= i; ++j) {
        if (inter[who[j]][1] >= i) {
          std::swap(greed[who[j]], greed[who[i]]);
          print_vector(greed, 0, n - 1);
          return;
        }
      }
      assert(false);
    }
    t.Set(1, 0, n - 1, i, interval[1]);
  }
  std::cout << "YES\n";
  print_vector(greed, 0, n - 1);
}
int main() {
  srand(time(0));
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  Run();
  return 0;
}
