#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2")
using namespace std;
bool eq(vector<pair<int, int> >& a, vector<pair<int, int> >& b) {
  sort(a.begin(), a.end()), sort(b.begin(), b.end());
  for (int i = 0; i < (int)(a.size()); ++i) {
    if (a[i] != b[i]) return 0;
  }
  return 1;
}
vector<int> create(vector<int>& cnt) {
  vector<int> ord, have, used(cnt.size(), 0);
  int n = cnt.size() - 1, j = 0;
  for (int i = 1; i < cnt.size(); ++i) have.push_back(i);
  for (int i = 1; i <= n; ++i) {
    if (cnt[i] == 0) continue;
    ord.push_back(i);
    used[i] = 1;
    cnt[i]--;
    while (j < have.size() && cnt[i] && have[j] < i) {
      while (used[have[j]] && j < have.size()) ++j;
      --cnt[i];
      ord.push_back(have[j]);
      ++j;
    }
    if (cnt[i]) {
      cout << "NO\n";
      exit(0);
    }
  }
  ord.push_back(n);
  return ord;
}
int main() {
  cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<pair<int, int> > a(n - 1), my;
  vector<int> cnt(n + 1, 0);
  for (int i = 0; i < a.size(); ++i) {
    cin >> a[i].first >> a[i].second;
    if (a[i].first > a[i].second) swap(a[i].first, a[i].second);
    if (a[i].second != n) {
      cout << "NO\n";
      exit(0);
    }
    cnt[a[i].first]++;
  }
  auto ord = create(cnt);
  vector<int> mx(ord.size(), ord[0]);
  for (int i = 1; i < ord.size(); ++i) mx[i] = max(mx[i - 1], ord[i]);
  for (int i = 1; i < (int)(ord.size()); ++i) {
    my.push_back({mx[i - 1], n});
  }
  if (!eq(a, my)) {
    cout << "NO\n";
    exit(0);
  }
  cout << "YES\n";
  for (int i = 1; i < ord.size(); ++i) {
    cout << ord[i - 1] << " " << ord[i] << "\n";
  }
  return 0;
}
