#include <bits/stdc++.h>
#pragma gcc optimize(o3)
using namespace std;
long long qpow(long long x, long long y) {
  return y ? (y & 1 ? x * qpow(x, y - 1) % 1000000007
                    : qpow(x * x % 1000000007, y / 2))
           : 1;
}
template <typename T>
inline void read(T& x) {
  x = 0;
  char c;
  int sign = 1;
  do {
    c = getchar();
    if (c == '-') sign = -1;
  } while (!isdigit(c));
  do {
    x = x * 10 + c - '0';
    c = getchar();
  } while (isdigit(c));
  x *= sign;
}
int cnt[200010], n, x, y, sum, last = -1;
int main() {
  read(n);
  for (long long i = 1; i <= n - 1; i++) {
    read(x), read(y);
    if (y != n) {
      puts("NO");
      return 0;
    }
    cnt[x]++;
  }
  for (long long i = 1; i <= n - 1; i++) {
    sum += cnt[i];
    if (sum > i) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  set<int> unused;
  unused.clear();
  for (long long i = 1; i <= n - 1; i++) unused.insert(i);
  for (long long i = 1; i <= n - 1; i++) {
    if (cnt[i] > 0) {
      unused.erase(i);
      if (last != -1) printf("%d %d\n", last, i);
      last = i;
      cnt[i]--;
    }
    while (cnt[i] > 0) {
      printf("%d %d\n", last, *unused.begin());
      last = *unused.begin();
      cnt[i]--;
      unused.erase(unused.begin());
    }
  }
  printf("%d %d\n", last, n);
  return 0;
}
