#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e9;
const long long MB = 31;
const long long MOD = 1e9 + 7;
void solve() {
  long long n;
  cin >> n;
  vector<pair<long long, long long>> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    a[i].first--;
    a[i].second--;
  }
  vector<vector<pair<long long, long long>>> b(n);
  for (long long i = 0; i < n; i++) {
    b[a[i].first].push_back({a[i].second, i});
  }
  vector<long long> id(n);
  set<pair<long long, long long>> st;
  for (long long i = 0; i < n; i++) {
    for (auto& p : b[i]) {
      st.insert(p);
    }
    auto p = *st.begin();
    st.erase(p);
    id[p.second] = i;
  }
  vector<long long> add(n);
  for (long long i = 0; i < n; i++) add[id[i]] = i;
  vector<vector<long long>> del(n);
  for (long long i = 0; i < n; i++)
    if (a[i].second + 1 < n) del[a[i].second + 1].push_back(i);
  st.clear();
  for (long long i = 0; i < n; i++) {
    for (long long j : del[i]) {
      st.erase({id[j], j});
    }
    if (!st.empty() && st.rbegin()->first >= a[add[i]].first) {
      long long ind = st.rbegin()->second;
      cout << "NO\n";
      for (long long i : id) cout << i + 1 << " ";
      cout << '\n';
      swap(id[st.rbegin()->second], id[add[i]]);
      for (long long i : id) cout << i + 1 << " ";
      return;
    }
    st.insert({i, add[i]});
  }
  cout << "YES\n";
  for (long long i : id) cout << i + 1 << " ";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(12);
  cout << fixed;
  long long t = 1;
  while (t--) solve();
}
