#include <bits/stdc++.h>
using namespace std;
int n, a[1005], q[1005], last = 1;
bool used[1005];
int main() {
  scanf("%d", &n);
  for (register int i = 1, x, y; i < n; ++i) {
    scanf("%d%d", &x, &y);
    if (x != n && y != n) {
      printf("NO\n");
      return 0;
    }
    if (x != n)
      a[i] = x;
    else
      a[i] = y;
  }
  sort(a + 1, a + n);
  for (register int i = 1; i < n; ++i) {
    if (i > a[i]) {
      printf("NO\n");
      return 0;
    } else if (a[i] > a[i - 1]) {
      q[i] = a[i];
      used[a[i]] = true;
    } else {
      while (used[last]) ++last;
      q[i] = last;
      used[last] = true;
    }
  }
  q[n] = n;
  printf("YES\n");
  for (register int i = 1; i < n; ++i) printf("%d %d\n", q[i], q[i + 1]);
  return 0;
}
