#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int n;
  cin >> n;
  vector<long long int> count(n + 1, 0);
  vector<long long int> input(n - 1);
  for (long long int i = 0; i < n - 1; i++) {
    long long int x, y;
    cin >> x >> y;
    if (x != n && y != n) {
      cout << "NO\n";
      return 0;
    }
    input[i] = min(x, y);
    count[x]++;
    count[y]++;
  }
  long long int appear = 0;
  for (long long int i = 1; i < n; i++) {
    appear += count[i];
    if (appear > i) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  sort(input.begin(), input.end());
  vector<long long int> result(n);
  set<long long int> toBeAssigned;
  for (long long int i = 1; i <= n; i++) toBeAssigned.insert(i);
  for (long long int i = 0; i < n - 1; i++) {
    if (toBeAssigned.count(input[i])) {
      result[i] = input[i];
    } else {
      result[i] = *toBeAssigned.begin();
    }
    toBeAssigned.erase(result[i]);
  }
  result[n - 1] = n;
  for (long long int i = 0; i < n - 1; i++) {
    cout << result[i] << ' ' << result[i + 1] << '\n';
  }
  return 0;
}
