#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  bool fl = 0;
  cin >> n;
  vector<int> v(n - 1);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    v[i] = min(a, b);
    if (max(a, b) != n) fl = 1;
  }
  vector<pair<int, int>> gr;
  sort(v.begin(), v.end());
  set<int> curr;
  for (int i = 1; i < n; i++) curr.insert(i);
  for (int i = 0; i < n - 1; i++) {
    int co = 1;
    while (i - 1 < n and v[i] == v[i + 1]) i++, co++;
    curr.erase(v[i]);
    if (co == 1)
      gr.push_back({n, v[i]});
    else {
      gr.push_back({n, *curr.begin()});
      for (int j = 0; j < co - 2; j++) {
        gr.push_back({*curr.begin(), *next(curr.begin())});
        curr.erase(curr.begin());
      }
      gr.push_back({v[i], *curr.begin()});
      int last = *curr.begin();
      curr.erase(curr.begin());
      if (last >= v[i]) {
        fl = 1;
        break;
      }
    }
  }
  if (fl)
    cout << "NO" << endl;
  else {
    cout << "YES" << endl;
    for (auto e : gr) cout << e.first << ' ' << e.second << endl;
  }
  return 0;
}
