#include <bits/stdc++.h>
using namespace std;
struct edge {
  int u, v;
};
vector<edge> Ans;
edge Data[1005];
int Count[1005];
int N;
bool flag = true;
set<int> S;
int main() {
  scanf("%d", &N);
  for (register int i = 1; i <= N - 1; ++i) {
    scanf("%d%d", &Data[i].u, &Data[i].v);
    ++Count[Data[i].u];
    ++Count[Data[i].v];
    if (Data[i].u == Data[i].v) flag = false;
    if (Data[i].u != N && Data[i].v != N) flag = false;
  }
  if (!flag) {
    printf("NO\n");
    return 0;
  }
  int Cur = 0;
  for (register int i = 1; i < N; ++i) {
    Cur += Count[i];
    if (Cur > i) {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  int Prev = -1;
  for (register int i = 1; i < N; ++i) S.insert(i);
  for (register int i = 1; i < N; ++i) {
    if (Count[i] > 0) {
      S.erase(i);
      if (Prev != -1) printf("%d %d\n", Prev, i);
      Prev = i;
      --Count[i];
    }
    while (Count[i] > 0) {
      printf("%d %d\n", Prev, *S.begin());
      Prev = *S.begin();
      --Count[i];
      S.erase(S.begin());
    }
  }
  printf("%d %d\n", Prev, N);
  return 0;
}
