#include <bits/stdc++.h>
struct arr {
  int x, y;
} a[1010], b[1010];
int n, i, j, k, t, sum = 0, x;
bool mark[1010];
int cmp(const void *a, const void *b) { return (*(arr *)a).x - (*(arr *)b).x; }
int main() {
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    if (a[i].y != n) break;
    if (a[i].x == n) break;
  }
  if (i < n) {
    printf("NO");
    return 0;
  }
  qsort(a + 1, n - 1, sizeof(a[0]), cmp);
  memset(mark, true, sizeof(mark));
  t = 0;
  for (i = 1; i < n; i = j) {
    mark[a[i].x] = false;
    for (j = i; j <= n; j++)
      if (a[j].x != a[i].x) break;
    k = j - i;
    b[++sum].x = x;
    b[sum].y = a[i].x;
    x = a[i].x;
    for (k--; k; k--) {
      for (t++; (t <= n) && !mark[t]; t++)
        ;
      if (t > a[i].x) break;
      b[++sum].x = x;
      b[sum].y = t;
      x = t;
    }
    if (t > a[i].x) break;
  }
  b[++sum].x = x;
  b[sum].y = n;
  if (sum < n) {
    printf("NO");
    return 0;
  } else {
    printf("YES\n");
    for (i = 2; i <= n; i++) printf("%d %d\n", b[i].x, b[i].y);
  }
  return 0;
}
