#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<long long> cnt(n + 1, 0);
  bool ch = 1;
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == n && b == n) ch = 0;
    cnt[a]++;
    cnt[b]++;
  }
  if (cnt[n] != n - 1) ch = 0;
  vector<vector<long long> > g(n + 1);
  vector<long long> v1;
  vector<long long> v2;
  for (long long i = n - 1; i >= 1; i--) {
    if (cnt[i])
      v1.push_back(i);
    else
      v2.push_back(i);
  }
  long long s2 = v2.size();
  long long j = 0;
  for (long long i = 0; i < v1.size(); i++) {
    long long d = cnt[v1[i]] - 1;
    long long p = n;
    while (d && j < s2) {
      g[p].push_back(v2[j]);
      p = v2[j];
      if (p > v1[i]) ch = 0;
      j++;
      d--;
    }
    if (d) ch = 0;
    g[p].push_back(v1[i]);
  }
  if (j != s2) ch = 0;
  if (ch) {
    cout << "YES"
         << "\n";
    for (long long i = 1; i <= n; i++) {
      for (auto it : g[i]) {
        cout << i << " " << it << "\n";
      }
    }
  } else
    cout << "NO";
  return 0;
}
