#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int n, d = 0;
  cin >> n;
  map<int, int> M, cnt;
  std::vector<int> v;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    if (b != n) d++;
    M[a]++;
    if (M[a] == 1) v.push_back(a);
  }
  std::vector<int> ans, v2;
  sort(v.begin(), v.end());
  for (int i = 1; i < n; i++) {
    if (M[i] == 0) v2.push_back(i);
  }
  int j = 0;
  for (int i = 0; i < (int)v.size(); i++) {
    int x = M[v[i]];
    ans.push_back(v[i]);
    int des = j + x - 2;
    if (des >= (int)v2.size()) {
      d++;
    }
    for (int k = j; k <= des; k++) ans.push_back(v2[k]);
    j = des + 1;
  }
  ans.push_back(n);
  int z = ans[0];
  cnt[z]++;
  for (int j = 1; j < (int)ans.size() - 1; j++) {
    z = max(z, ans[j]);
    cnt[z]++;
  }
  for (int i = 1; i < n; i++) {
    if (cnt[i] != M[i]) {
      d++;
    }
  }
  if (d > 0)
    cout << "NO";
  else {
    cout << "YES\n";
    for (int j = 0; j < ans.size() - 1; j++)
      cout << ans[j] << " " << ans[j + 1] << "\n";
  }
  return 0;
}
