Phoenix is trying to take a photo of his n friends with labels 1, 2, ..., n who are lined up in a row in a special order. But before he can take the photo, his friends get distracted by a duck and mess up their order.

Now, Phoenix must restore the order but he doesn't remember completely! He only remembers that the i-th friend from the left had a label between a_i and b_i inclusive. Does there exist a unique way to order his friends based of his memory? 

Input

The first line contains one integer n (1 ≤ n ≤ 2⋅10^5) — the number of friends.

The i-th of the next n lines contain two integers a_i and b_i (1 ≤ a_i ≤ b_i ≤ n) — Phoenix's memory of the i-th position from the left.

It is guaranteed that Phoenix's memory is valid so there is at least one valid ordering.

Output

If Phoenix can reorder his friends in a unique order, print YES followed by n integers — the i-th integer should be the label of the i-th friend from the left.

Otherwise, print NO. Then, print any two distinct valid orderings on the following two lines. If are multiple solutions, print any.

Examples

Input


4
4 4
1 3
2 4
3 4


Output


YES
4 1 2 3 


Input


4
1 3
2 4
3 4
2 3


Output


NO
1 3 4 2 
1 2 4 3 
#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2, class T3 = hash<T1>>
using umap = unordered_map<T1, T2, T3>;
template <class T>
using uset = unordered_set<T>;
template <class T>
using vec = vector<T>;
const long long infll = numeric_limits<long long>::max() >> 1;
const int inf = numeric_limits<int>::max() >> 1;
const int N = 4e5 + 5;
const int M = 2e5 + 1;
int n;
int pos[N];
int ind[N];
pair<int, int> p[N];
vec<pair<int, int>> upd[N];
set<pair<int, int>> opt;
set<int> ins;
bool vis[N];
bool stk[N];
vec<int> cycle;
vec<int> st;
struct Dsu {
  int par[N];
  int cnt[N];
  int nxt[N];
} dsu;
bool dfs(int);
bool visit(int, int);
int root(int u) { return dsu.par[u] == u ? u : dsu.par[u] = root(dsu.par[u]); }
void unite(int u, int v) {
  u = root(u);
  v = root(v);
  if (dsu.cnt[u] < dsu.cnt[v]) {
    swap(u, v);
  }
  dsu.nxt[u] = max(dsu.nxt[u], dsu.nxt[v]);
  dsu.cnt[u] += dsu.cnt[v];
  dsu.par[v] = u;
}
void input() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i].first;
    cin >> p[i].second;
    upd[p[i].first].push_back({p[i].second, i});
  }
}
void construct_matching() {
  for (int i = 1; i <= n; ++i) {
    for (pair<int, int> p : upd[i]) {
      opt.insert(p);
    }
    ind[opt.begin()->second] = i;
    pos[i] = opt.begin()->second;
    opt.erase(opt.begin());
  }
}
bool visit(int l, int r, int p) {
  int x = *ins.lower_bound(l);
  if (x == p) {
    x = *ins.upper_bound(p);
  }
  if (x <= r) {
    while (st.back() != x) {
      cycle.push_back(st.back());
      st.pop_back();
    }
    cycle.push_back(st.back());
    st.pop_back();
    return 1;
  }
  for (int i = dsu.nxt[root(l)]; i <= r; i = dsu.nxt[root(i + 1)]) {
    if (i == p) {
      continue;
    }
    unite(i, i + 1);
    if (dfs(i)) {
      return 1;
    }
  }
  return 0;
}
bool dfs(int u) {
  st.push_back(u);
  ins.insert(u);
  vis[u] = 1;
  stk[u] = 1;
  if (u <= n) {
    if (visit(p[u].first + n, p[u].second + n, ind[u] + n)) {
      return 1;
    }
  } else {
    if (visit(pos[u - n], pos[u - n], 0)) {
      return 1;
    }
  }
  stk[u] = 0;
  st.pop_back();
  ins.erase(u);
  return 0;
}
void answer() {
  cout << "NO\n";
  for (int i = 1; i <= n; ++i) {
    cout << ind[i] << " ";
  }
  cout << "\n";
  for (int i = 0; i < (int)cycle.size(); ++i) {
    if (cycle[i] <= n) {
      ind[cycle[i]] =
          cycle[(i - 1 + (int)cycle.size()) % (int)cycle.size()] - n;
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << ind[i] << " ";
  }
  cout << "\n";
}
void solve() {
  ins.insert(inf);
  construct_matching();
  for (int i = 1; i <= 2 * n + 1; ++i) {
    dsu.cnt[i] = 1;
    dsu.par[i] = i;
    dsu.nxt[i] = i;
  }
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      if (dfs(i)) {
        answer();
        return;
      }
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; ++i) {
    cout << ind[i] << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  input();
  solve();
}
