#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 10;
const long long M = 2 * N * N + 10;
const long long inf = 1e6;
const long long Mod = 998244353;
int cnt[N];
int n;
int main() {
  int x, y;
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; ++i) {
    scanf("%d%d", &x, &y);
    if (y != n) {
      puts("NO");
      return 0;
    }
    cnt[x]++;
  }
  int cur = 0;
  for (int i = 1; i <= n; ++i) {
    cur += cnt[i];
    if (cur > i) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  set<int> unsure;
  for (int i = 1; i < n; ++i) unsure.insert(i);
  int last = -1;
  for (int i = 1; i < n; ++i) {
    if (cnt[i] > 0) {
      unsure.erase(i);
      if (last == -1)
        last = i;
      else
        printf("%d %d\n", last, i);
      last = i;
      cnt[i]--;
    }
    while (cnt[i] > 0) {
      printf("%d %d\n", last, *unsure.begin());
      last = *unsure.begin();
      cnt[i]--;
      unsure.erase(last);
    }
  }
  printf("%d %d", last, n);
  return 0;
}
