#include <bits/stdc++.h>
const long double pi = acos(-1.0);
const long double eps = 1e-6;
using namespace std;
const int N = 1e5 + 1;
int n;
int kol[N];
void solve() {
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int x, y;
    cin >> x >> y;
    if (x > y) swap(x, y);
    if (y != n) {
      cout << "NO" << endl;
      return;
    }
    if (x == n) {
      cout << "NO" << endl;
      return;
    }
    kol[x]++;
  }
  vector<int> em;
  vector<pair<int, int>> v;
  for (int i = 1; i <= n - 1; i++) {
    if (kol[i] == 0)
      em.push_back(i);
    else
      v.push_back({i, kol[i]});
    if (kol[i] > i) {
      cout << "NO" << endl;
      return;
    }
  }
  reverse(v.begin(), v.end());
  vector<pair<int, int>> ans;
  for (auto u : v) {
    int last = n;
    for (int j = 1; j < u.second; j++) {
      if (em.size() == 0) {
        cout << "NO" << endl;
        return;
      }
      ans.push_back({last, em.back()});
      last = em.back();
      if (last > u.first) {
        cout << "NO" << endl;
        return;
      }
      em.pop_back();
    }
    ans.push_back({last, u.first});
  }
  if (em.size() != 0) {
    cout << "NO" << endl;
    return;
  }
  cout << "YES" << endl;
  for (auto x : ans) cout << x.first << " " << x.second << endl;
}
int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(15);
  int step;
  step = 1;
  for (int i = 1; i <= step; i++) {
    solve();
  }
}
