#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
int fuk_off[1000];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  clock_t clk = clock();
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    if (a == n) swap(a, b);
    if (b != n || a == n) {
      cout << "NO";
      return 0;
    }
    fuk_off[a]++;
  }
  bool pos = true;
  vector<pair<long long int, long long int> > ans;
  vector<long long int> non_used;
  for (int i = 1; i <= n - 1; i++) {
    if (fuk_off[i] == 0) non_used.push_back(i);
  }
  reverse(non_used.begin(), non_used.end());
  for (int i = 1; i <= n - 1; i++) {
    if (fuk_off[i] == 0) continue;
    int t = fuk_off[i];
    t--;
    if (t == 0) {
      ans.push_back({n, i});
      continue;
    }
    int last = n;
    while (t--) {
      if (non_used.size() == 0) {
        cout << "NO";
        return 0;
      }
      ans.push_back({last, non_used.back()});
      last = non_used.back();
      non_used.pop_back();
    }
    if (last > i) {
      cout << "NO";
      return 0;
    }
    ans.push_back({last, i});
  }
  if (non_used.size() != 0)
    cout << "NO";
  else {
    cout << "YES" << endl;
    for (auto x : ans) cout << x.first << " " << x.second << endl;
  }
  cerr << endl
       << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
  return 0;
}
