#include <bits/stdc++.h>
using namespace std;
vector<int> vals;
int spares[1005];
vector<pair<int, int> > edges;
int main() {
  int N;
  cin >> N;
  for (int i = 1; i < N; i++) {
    int x, y;
    cin >> x >> y;
    if (x == N) {
      int t = y;
      y = x;
      x = t;
    }
    if (x == N || y != N) {
      cout << "NO" << endl;
      return 0;
    }
    vals.push_back(x);
  }
  sort(vals.begin(), vals.end());
  int lo = 0;
  int hi = 0;
  int last = 1;
  for (int i = 0; i < N - 1; i++) {
    int path = 0;
    while (i + 1 < N - 1 && vals[i] == vals[i + 1]) {
      i++;
      path++;
    }
    if (vals[i] < i + 1) {
      cout << "NO" << endl;
      return 0;
    }
    while (last < vals[i]) {
      spares[hi++] = last++;
    }
    last = vals[i] + 1;
    int start = N;
    for (int k = 0; k < path; k++) {
      int v = spares[lo++];
      edges.push_back({start, v});
      start = v;
    }
    edges.push_back({start, vals[i]});
  }
  cout << "YES" << endl;
  for (int i = 0; i < N - 1; i++) {
    cout << edges[i].first << " " << edges[i].second << endl;
  }
  return 0;
}
