#include <bits/stdc++.h>
using namespace std;
int n, m;
int x[1010], y[1010];
bool used[1010];
int vis[1010], p[1010];
int ans[1010];
int X[1010], Y[1010];
int read() {
  int sum = 0;
  char c = getchar(), flag = ' ';
  while (c < '0' || c > '9') flag = c, c = getchar();
  while (c >= '0' && c <= '9')
    sum = (sum << 1) + (sum << 3) + c - '0', c = getchar();
  if (flag == '-') sum *= -1;
  return sum;
}
bool cmp(int x, int y) { return x > y; }
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    x[i] = read();
    y[i] = read();
    if (x[i] > y[i]) swap(x[i], y[i]);
    if (y[i] != n) {
      puts("NO");
      return 0;
    }
    used[x[i]] = 1;
  }
  for (int i = 1; i < n; i++)
    if (used[i] == 0) ans[++ans[0]] = i;
  sort(x + 1, x + n, cmp);
  m = n;
  for (int i = 2, last = 1; i <= n; i++) {
    if (x[i] != x[i - 1]) {
      int j = i - last - 1;
      if (ans[0] < j) {
        printf("NO\n");
        return 0;
      }
      for (int k = 1; k <= j; k++) {
        if (ans[ans[0]] > x[i - 1]) {
          printf("NO\n");
          return 0;
        }
        X[++X[0]] = m, Y[++Y[0]] = m = ans[ans[0]--];
      }
      X[++X[0]] = m, Y[++Y[0]] = m = x[i - 1];
      last = i;
    }
  }
  printf("YES\n");
  for (int i = 1; i <= X[0]; i++) printf("%d %d\n", X[i], Y[i]);
  return 0;
}
