#include <bits/stdc++.h>
using namespace std;
const double PI =
    3.14159265358979323846264338327950288419716939937510582097494459230781641;
const long long int M = 1e16;
const long long int MAXN = 200001;
long long int i, j, mask;
void solve() {
  long long int n;
  cin >> n;
  vector<pair<long long int, long long int> > v;
  vector<long long int> a(n + 1), tmp;
  bool flag = false;
  for (i = 0; i < n - 1; i++) {
    long long int l, r;
    cin >> l >> r;
    if (l > r) {
      swap(l, r);
    }
    if (r != n) flag = true;
    a[l]++;
  }
  if (flag) {
    cout << "NO";
    return;
  }
  long long int val = n;
  for (i = 1; i < n + 1; i++) {
    if (a[i]) {
      if (tmp.size() < a[i] - 1) {
        cout << "NO";
        return;
      }
      for (j = 0; j < a[i] - 1; j++) {
        v.push_back({tmp.back(), val});
        val = tmp.back();
        tmp.pop_back();
      }
      v.push_back({i, val});
      val = n;
    } else {
      tmp.push_back(i);
    }
  }
  cout << "YES";
  cout << "\n";
  for (auto x : v) {
    cout << x.first << " " << x.second;
    cout << "\n";
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
