#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, order[maxn], used[maxn];
pair<int, int> x[maxn];
int main() {
  cin >> n;
  int u, v;
  bool works = true;
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    if (v != n) works = false;
    x[i] = make_pair(u, v);
  }
  sort(x, x + n);
  for (int i = 1; i < n; i++) {
    if (x[i].first < i) {
      works = false;
    }
  }
  if ((x[0].first == 1 && x[1].first == 1) || !works) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    order[1] = x[1].first;
    used[order[1]] = 1;
    for (int i = 2; i < n; i++) {
      if (x[i].first == x[i - 1].first) continue;
      order[i] = x[i].first;
      used[order[i]] = 1;
    }
    order[n] = n;
    used[order[n]] = 1;
    vector<int> rest;
    for (int i = 1; i <= n; i++) {
      if (!used[i]) rest.push_back(i);
    }
    reverse(rest.begin(), rest.end());
    for (int i = 1; i <= n; i++) {
      if (!order[i]) {
        order[i] = rest.back();
        rest.pop_back();
      }
    }
    for (int i = 1; i < n; i++) {
      cout << order[i] << ' ' << order[i + 1] << "\n";
    }
  }
}
