#include <bits/stdc++.h>
using namespace std;
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  };
  int n;
  cin >> n;
  int a[n + 5], b[n + 5];
  for (int i = 0; i < n - 1; i++) {
    cin >> a[i] >> b[i];
    if (b[i] != n) {
      cout << "NO" << endl;
      return 0;
    }
  }
  sort(a, a + n - 1);
  a[n - 1] = n;
  set<int> second;
  for (int i = 1; i <= n; i++) second.insert(i);
  vector<int> ans;
  int mx = 0;
  for (int i = 0; i < n; i++) {
    if (i > 0 && a[i] == a[i - 1]) {
      if (*second.begin() < mx) {
        ans.push_back(*second.begin());
        second.erase(*second.begin());
      } else {
        cout << "NO" << endl;
        return 0;
      }
    } else {
      ans.push_back(a[i]);
      second.erase(a[i]);
      mx = max(mx, a[i]);
    }
  }
  cout << "YES" << endl;
  for (int i = 1; i < n; i++) {
    cout << ans[i - 1] << ' ' << ans[i] << endl;
  }
}
