#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 5;
vector<int> g[N];
void go() {
  puts("NO");
  exit(0);
}
int pref[N];
signed main() {
  int n;
  scanf("%d", &n);
  vector<int> vec;
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (b != n) {
      go();
    }
    vec.push_back(a);
  }
  sort(vec.begin(), vec.end());
  set<int> can;
  for (int i = 1; i <= n; i++) {
    can.insert(i);
  }
  vector<int> path;
  for (int i = 0; i < (int)vec.size(); i++) {
    int x = vec[i];
    if (can.find(x) != can.end()) {
      path.push_back(x);
      can.erase(x);
      continue;
    } else {
      int best = *can.begin();
      if (best > x) {
        go();
      }
      path.push_back(best);
      can.erase(best);
    }
  }
  path.push_back(n);
  puts("YES");
  for (int i = 0; i < n - 1; i++) {
    cout << path[i] << " " << path[i + 1] << endl;
  }
}
