#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int cnt[N], n;
set<int> st;
int read() {
  int X = 0, p = 1;
  char c = getchar();
  for (; c > '9' || c < '0'; c = getchar())
    if (c == '-') p = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) X = X * 10 + c - '0';
  return X * p;
}
int main() {
  n = read();
  for (int i = 1; i < n; ++i) {
    int u = read(), v = read();
    if (v != n) return puts("NO"), 0;
    cnt[u]++;
  }
  int cur = 0;
  for (int i = 1; i < n; ++i)
    if ((cur += cnt[i]) > i) return puts("NO"), 0;
  for (int i = 1; i < n; ++i) st.insert(i);
  puts("YES");
  int last = 0;
  for (int i = 1; i < n; ++i) {
    if (cnt[i]) {
      st.erase(i);
      if (last) printf("%d %d\n", last, i);
      cnt[i]--;
      last = i;
    }
    while (cnt[i]) {
      printf("%d %d\n", last, *st.begin());
      last = *st.begin();
      cnt[i]--;
      st.erase(*st.begin());
    }
  }
  printf("%d %d\n", last, n);
}
