#include <bits/stdc++.h>
using namespace std;
struct s1 {
  int s, t;
  s1(int si = 0, int ti = 0) { s = si, t = ti; }
} e[1002];
int n, x, y, et, cnt[1002], a[1002], b[1002], at, bt, lst;
bool ans = true;
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &x, &y);
    if (x == n)
      ++cnt[y];
    else if (y == n)
      ++cnt[x];
    else
      ans = false;
  }
  for (int i = 1; i <= n; ++i)
    if (cnt[i])
      a[++at] = i;
    else
      b[++bt] = i;
  sort(a + 1, a + at + 1);
  sort(b + 1, b + bt + 1);
  for (int i = 1, j = 0; i <= at; ++i) {
    if (lst != 0) e[++et] = s1(lst, a[i]);
    lst = a[i];
    for (int k = 2; k <= cnt[a[i]]; ++k) {
      e[++et] = s1(lst, b[++j]);
      lst = b[j];
      if (b[j] > a[i]) ans = false;
    }
    if (i == at) e[++et] = s1(lst, n);
  }
  if (ans) {
    printf("YES\n");
    for (int i = 1; i <= et; ++i) {
      printf("%d %d", e[i].s, e[i].t);
      if (i != et) printf("\n");
    }
  } else
    printf("NO\n");
  return 0;
}
