#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int> > p;
vector<pair<int, int> > edges;
void read_data() {
  cin >> n;
  int ai, bi;
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &ai, &bi);
    if (ai > bi) swap(ai, bi);
    p.push_back(make_pair(ai, bi));
  }
  sort(p.begin(), p.end());
}
bool deal() {
  for (int i = 0; i < n - 1; i++)
    if (p[i].second != n) return false;
  stack<int> s;
  int tod = 1;
  int prev = n;
  int i = 0;
  while (i < n - 1) {
    const pair<int, int> &pi = p[i];
    int ai = pi.first;
    while (tod != ai) {
      s.push(tod++);
    }
    vector<pair<int, int> >::iterator it1 = lower_bound(p.begin(), p.end(), pi);
    vector<pair<int, int> >::iterator it2 = upper_bound(p.begin(), p.end(), pi);
    int cnt = it2 - it1;
    if (cnt == 1) {
      edges.push_back(make_pair(ai, n));
      tod++;
    } else if (s.size() < cnt - 1) {
      return false;
    } else {
      int prev = n;
      while (cnt > 1) {
        int v = s.top();
        s.pop();
        edges.push_back(make_pair(v, prev));
        prev = v;
        cnt--;
      }
      edges.push_back(make_pair(ai, prev));
      tod++;
    }
    i += it2 - it1;
  }
  return true;
}
int main() {
  read_data();
  if (deal()) {
    cout << "YES" << endl;
    for (auto &v : edges) {
      cout << v.first << ' ' << v.second << endl;
    }
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
