#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
int dcmp(double x) {
  if (x < -eps)
    return -1;
  else
    return x > eps;
}
const int N = 1010;
int cnt[N], mk[N];
int n;
vector<pair<int, int> > vans;
int solve() {
  memset(cnt, 0, sizeof(cnt));
  memset(mk, 0, sizeof(mk));
  int a, b;
  for (int i = 0; i < (int)(n - 1); i++) {
    scanf("%d%d", &a, &b);
    cnt[a]++;
    cnt[b]++;
  }
  if (cnt[n] != n - 1) {
    return false;
  }
  vans.clear();
  int root = n;
  mk[n] = 1;
  for (int u = n - 1; u >= 1; --u) {
    if (cnt[u] == 0) {
      if (mk[u] == 0) {
        return false;
      }
      continue;
    }
    for (int i = cnt[u]; i > 1; --i) {
      int v = u - 1;
      for (; v >= 1; --v) {
        if (mk[v] == 0 && cnt[v] == 0) {
          break;
        }
      }
      if (v == 0) {
        return false;
      }
      vans.push_back(make_pair(root, v));
      root = v;
      mk[v] = 1;
    }
    vans.push_back(make_pair(root, u));
    root = u;
    mk[u] = 1;
  }
  return true;
}
int main(int argc, char *argv[]) {
  while (scanf("%d", &n) != EOF) {
    bool ret = solve();
    puts(ret ? "YES" : "NO");
    if (ret) {
      for (int i = 0; i < (int)(((int)vans.size())); i++) {
        printf("%d %d\n", vans[i].first, vans[i].second);
      }
    }
  }
  return 0;
}
