#include <bits/stdc++.h>
using namespace std;
pair<int, int> m[10001];
int quan[10000], cd;
int kq[10000];
vector<int> ruler;
void no_copy() {
  int bef = 0;
  int s = -1;
  for (int i = 1; i <= cd; i++) {
    if (quan[i] == 0) {
      ruler.push_back(i);
      continue;
    }
    if (s == -1) s = i;
    kq[bef] = i;
    bef = i;
    while (quan[i] > 1) {
      int k = ruler.size();
      if (k == 0) {
        cout << "NO" << endl;
        return;
      }
      kq[bef] = ruler[k - 1];
      bef = ruler[k - 1];
      ;
      ruler.pop_back();
      quan[i]--;
    }
  }
  kq[bef] = cd;
  cout << "YES" << endl;
  bef = s;
  while (kq[bef] != 0) {
    cout << bef << " " << kq[bef] << endl;
    bef = kq[bef];
  }
}
void inp() {
  cin >> cd;
  for (int i = 1; i < cd; i++) {
    cin >> m[i].first >> m[i].second;
    if (m[i].second < cd) {
      cout << "NO" << endl;
      return;
    }
    quan[m[i].first]++;
  }
  no_copy();
}
int main() { inp(); }
