#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T& a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T& a, T b) {
  return a < b ? (a = b, true) : false;
}
struct dsu {
  vector<int> p;
  dsu(int n) : p(n, -1) {}
  inline int size(int x) { return -p[get(x)]; }
  inline bool same_set(int a, int b) { return get(a) == get(b); }
  int get(int x) { return p[x] < 0 ? x : p[x] = get(p[x]); }
  inline bool unite(int a, int b) {
    a = get(a);
    b = get(b);
    if (a == b) return false;
    if (p[a] > p[b]) swap(a, b);
    p[a] += p[b];
    p[b] = a;
    return true;
  }
};
void bad() {
  cout << "NO" << '\n';
  exit(0);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> cnt(n, 0);
  vector<vector<int>> g(n);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    if (u > v) swap(u, v);
    if (v != n - 1) bad();
    ++cnt[u];
  }
  dsu uf(n);
  vector<int> st;
  vector<int> X, Y;
  for (int i = 0; i < n; ++i) {
    if (!cnt[i]) {
      st.push_back(i);
    } else {
      int x = i;
      for (int j = 0; j < cnt[i] - 1; ++j) {
        if (st.empty()) bad();
        int y = st.back();
        uf.unite(x, y);
        st.pop_back();
        X.push_back(x);
        Y.push_back(y);
        x = y;
      }
      X.push_back(x);
      Y.push_back(n - 1);
      uf.unite(x, n - 1);
    }
  }
  assert(uf.size(0) == n);
  cout << "YES" << '\n';
  for (int i = 0; i < n - 1; ++i) cout << X[i] + 1 << ' ' << Y[i] + 1 << '\n';
}
