#include <bits/stdc++.h>
using namespace std;
long long a[1007];
long long r[1007];
long long c[1007];
int main() {
  long long n, x, y, t;
  scanf("%I64d", &n);
  ;
  for (int i = 1; i < n; ++i) {
    scanf("%I64d", &x);
    ;
    scanf("%I64d", &y);
    ;
    if (x != n && y != n || x == n && y == n) {
      printf("NO\n");
      return 0;
    } else if (x == n) {
      a[i] = y;
    } else {
      a[i] = x;
    }
  }
  for (int i = 1; i <= n; ++i) c[a[i]]++;
  t = 0;
  for (int i = 1; i <= n; ++i) {
    t += c[i];
    if (t > i) {
      printf("NO\n");
      return 0;
    }
  }
  t = 1;
  r[1] = n;
  for (int i = n - 1; i >= 1; --i) {
    if (c[i] > 0) {
      t += c[i];
      r[t] = i;
    } else {
      for (int j = 1; j <= n; ++j) {
        if (r[j] == 0) {
          r[j] = i;
          break;
        }
      }
    }
  }
  printf("YES\n");
  for (int i = 1; i < n; ++i) printf("%I64d %I64d\n", r[i], r[i + 1]);
  return 0;
}
