#include <bits/stdc++.h>
using namespace std;
int a[1009], b[1009], cnt[1009], val[1009], siz[1009];
vector<int> chains;
vector<pair<int, int> > edges;
set<int> lol;
int main() {
  int i, j, t1, t2, t3, t4, n, tots = 0;
  scanf("%d", &n);
  for (i = 0; i < n - 1; i++) {
    scanf("%d %d", &t1, &t2);
    a[i] = min(t1, t2);
    b[i] = max(t1, t2);
  }
  for (i = 0; i < n - 1; i++) {
    if (b[i] != n) {
      printf("NO\n");
      return 0;
    }
    cnt[a[i]]++;
  }
  for (i = 1; i <= n - 1; i++) {
    lol.insert(i);
  }
  for (i = 1; i <= n - 1; i++) {
    if (cnt[i]) {
      tots++;
      siz[i] = cnt[i];
      val[i] = i;
      lol.erase(i);
      chains.push_back(i);
    }
  }
  sort(chains.begin(), chains.end());
  for (auto it : chains) {
    t1 = n;
    for (j = 0; j < siz[it] - 1; j++) {
      if (lol.empty()) {
        printf("NO\n");
        return 0;
      }
      auto it2 = lol.begin();
      if (*it2 > it) {
        printf("NO\n");
        return 0;
      }
      edges.push_back(make_pair(t1, *it2));
      t1 = *it2;
      lol.erase(it2);
    }
    edges.push_back(make_pair(t1, it));
  }
  printf("YES\n");
  for (auto it : edges) {
    printf("%d %d\n", it.first, it.second);
  }
  return 0;
}
