#include <bits/stdc++.h>
using namespace std;
vector<long long> vc, vcc;
long long n, x, y, d[1000 + 69], l, nho[1000 + 69];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = (1); i <= (n - 1); ++i) {
    cin >> x >> y;
    if (x > y) swap(x, y);
    if (y != n) {
      cout << "NO";
      return 0;
    }
    d[x]++;
  }
  for (long long i = (1); i <= (n); ++i) {
    if (d[i] == 1) nho[i] = n;
    if (d[i] > 1) vc.push_back(i);
    if (d[i] == 0 && i < n) vcc.push_back(i);
  }
  sort(vcc.begin(), vcc.end());
  sort(vc.begin(), vc.end());
  if (vc.size())
    for (long long i = (0); i <= (vc.size() - 1); ++i) {
      long long sz = d[vc[i]] - 1;
      if (vcc[l] > vc[i]) {
        cout << "NO";
        return 0;
      }
      nho[vcc[l]] = n;
      for (long long j = (0); j <= (sz - 2); ++j) {
        if (vcc[l + j + 1] > vc[i]) {
          cout << "NO";
          return 0;
        }
        nho[vcc[l + j + 1]] = vcc[l + j];
      }
      nho[vc[i]] = vcc[l + sz - 1];
      l = l + sz;
    }
  for (long long i = (1); i <= (n - 1); ++i)
    if (nho[i] == 0) {
      cout << "NO";
      return 0;
    }
  cout << "YES\n";
  for (long long i = (1); i <= (n - 1); ++i) cout << i << " " << nho[i] << "\n";
}
