#include <bits/stdc++.h>
using namespace std;
int n, x[200005], y[200005], z[200005], la = -1, lb;
vector<pair<int, int>> v[200005];
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>
    q;
stack<pair<int, int>> s;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", y + i, z + i);
    v[y[i]].emplace_back(z[i], i);
  }
  for (int i = 1; i <= n; i++) {
    for (auto& j : v[i]) q.push(j);
    int tmp = q.top().second;
    q.pop();
    while (!s.empty() && z[s.top().second] < i) s.pop();
    if (!s.empty() && y[tmp] <= s.top().first) {
      la = s.top().second;
      lb = tmp;
    }
    s.emplace(i, tmp);
    x[tmp] = i;
  }
  puts(la == -1 ? "YES" : "NO");
  for (int i = 1; i <= n; i++) printf("%d%c", x[i], " \n"[i == n]);
  if (la != -1)
    for (int i = 1; i <= n; i++)
      printf("%d%c", i == la ? x[lb] : i == lb ? x[la] : x[i], " \n"[i == n]);
}
