#include <bits/stdc++.h>
using namespace std;
long long power(long long base, long long exp, long long MOD) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base) % MOD;
    base = (base * base) % MOD;
    exp /= 2;
  }
  return res % MOD;
}
void NO() {
  cout << "NO";
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, b;
  cin >> n;
  vector<int> a(n - 1), cnt(n, 0);
  for (int i = 1; i <= n - 1; i++) {
    cin >> a[i] >> b;
    if (b != n) {
      NO();
    }
    cnt[a[i]]++;
  }
  sort(a.begin(), a.end());
  int cur = 0;
  for (int i = 1; i < n; i++) {
    cur += cnt[i];
    if (cur > i) {
      NO();
    }
  }
  cout << "YES\n";
  int last = -1;
  set<int> unused;
  for (int i = 1; i < n; i++) {
    unused.insert(i);
  }
  for (int i = 1; i < n; i++) {
    if (cnt[i] > 0) {
      unused.erase(i);
      if (last != -1) cout << last << " " << i << "\n";
      last = i;
      cnt[i]--;
    }
    while (cnt[i] > 0) {
      cout << last << " " << *unused.begin() << "\n";
      last = *unused.begin();
      cnt[i]--;
      unused.erase(unused.begin());
    }
  }
  cout << last << " " << n;
  return 0;
}
