#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e3 + 13;
int t[MAXN];
stack<int> stos;
stack<int> wyn;
int main() {
  int n;
  int x, y;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &x, &y);
    t[x]++;
    t[y]++;
  }
  if (t[n] != n - 1) {
    printf("NO");
    return 0;
  }
  for (int i = n - 1; i > 0; i--) {
    if (t[i] == 0) stos.push(i);
  }
  for (int i = 1; i < n; i++) {
    int pop = i;
    int base = i;
    while (!stos.empty() && t[i] > 1) {
      int k = stos.top();
      stos.pop();
      if (k > base) {
        printf("NO");
        return 0;
      }
      wyn.push(pop);
      wyn.push(k);
      pop = k;
      t[i]--;
    }
    if (t[i] == 1) {
      wyn.push(pop);
      wyn.push(n);
      t[i]--;
    }
    if (t[i] != 0) {
      printf("NO");
      return 0;
    }
  }
  printf("YES\n");
  while (!wyn.empty()) {
    printf("%d ", wyn.top());
    wyn.pop();
    printf("%d\n", wyn.top());
    wyn.pop();
  }
}
