#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000 + 50;
int n, cnt[maxn], a[maxn];
vector<int> q;
int main() {
  cin >> n;
  int sign = 0;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    if (x > y) swap(x, y);
    if (y != n) sign = 1;
    cnt[x]++;
    a[i] = x;
  }
  sort(a + 1, a + n);
  for (int i = 1; i < n; i++) {
    if (a[i] < i) {
      sign = 1;
    }
  }
  if (sign) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 1; i < n; i++) {
    if (cnt[i]) {
      q.push_back(i);
    }
  }
  int opt = 1;
  for (int x = 0; x < q.size(); x++) {
    int pre = n;
    for (int i = 1; i <= cnt[q[x]] - 1; i++) {
      while (cnt[opt]) opt++;
      cout << pre << ' ' << opt << endl;
      pre = opt;
      opt++;
    }
    cout << pre << ' ' << q[x] << endl;
  }
  return 0;
}
