#include <bits/stdc++.h>
using namespace std;
int n, x, z, y, a[550000];
vector<int> vec[550000];
set<int> second;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    if (x == n)
      a[y]++;
    else if (y == n)
      a[x]++;
    else {
      cout << "NO";
      return 0;
    }
  }
  for (int i = 1; i < n; i++) second.insert(i);
  for (int i = 1; i < n; i++) {
    if (a[i] > 0) {
      z++;
      vec[z].push_back(n);
      while (a[i] > 0) {
        a[i]--;
        int q = *second.begin();
        if (q > i) {
          cout << "NO";
          return 0;
        }
        if (a[i] == 0 && q != i) q = i;
        second.erase(q);
        vec[z].push_back(q);
      }
    }
  }
  cout << "YES\n";
  for (int i = 1; i < n; i++)
    for (int j = vec[i].size() - 2; j >= 0; j--)
      cout << vec[i][j + 1] << ' ' << vec[i][j] << "\n";
  return 0;
}
