#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  vector<pair<long long int, long long int> > v(n);
  vector<long long int> cnt(n + 1, 0);
  for (long long int i = 1; i <= n - 1; i++) {
    cin >> v[i].first >> v[i].second;
    cnt[v[i].first]++;
    cnt[v[i].second]++;
  }
  long long int tmp = 0;
  for (long long int i = 1; i < n; i++) {
    tmp += cnt[i];
    if (tmp > i) {
      cout << "NO"
           << "\n";
      return 0;
    }
  }
  if (cnt[n] != n - 1) {
    cout << "NO"
         << "\n";
    return 0;
  }
  long long int last = -1;
  cout << "YES"
       << "\n";
  set<long long int> st;
  for (long long int i = 1; i < n; i++) st.insert(i);
  for (long long int i = 1; i < n; i++) {
    if (cnt[i] > 0) {
      if (last != -1) {
        cout << last << " " << i << "\n";
      }
      last = i;
      cnt[i]--;
      st.erase(i);
    }
    while (cnt[i] > 0) {
      cout << last << " " << *(st.begin()) << "\n";
      last = *st.begin();
      st.erase(st.begin());
      cnt[i]--;
    }
  }
  cout << last << " " << n << "\n";
  return 0;
}
