#include <bits/stdc++.h>
using namespace std;
const long long N = 1005;
long long n, a[N], cnt[N];
set<long long> s;
vector<long long> vec;
bool vis[N];
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i < n; i++) {
    long long x, y;
    scanf("%lld %lld", &x, &y);
    if (y != n) {
      printf("NO");
      return 0;
    }
    cnt[x]++;
  }
  for (long long i = 1, cur = 0; i < n; i++) {
    cur += cnt[i];
    if (cur > i) {
      printf("NO");
      return 0;
    }
  }
  for (long long i = 1; i < n; i++) s.insert(i);
  printf("YES\n");
  long long last = -1;
  for (long long i = 1; i < n; i++) {
    if (cnt[i] > 0) {
      s.erase(i);
      if (last != -1) {
        printf("%lld %lld\n", last, i);
      }
      last = i;
      cnt[i]--;
    }
    while (cnt[i] > 0) {
      long long k = *s.begin();
      printf("%lld %lld\n", last, k);
      last = k;
      s.erase(k);
      cnt[i]--;
    }
  }
  printf("%lld %lld\n", last, n);
  return 0;
}
