#include <bits/stdc++.h>
using namespace std;
ifstream in;
ofstream out;
const long long kk = 1000;
const long long ml = kk * kk;
const long long mod = ml * kk + 7;
const long long inf = ml * ml * ml + 7;
long long n, i, j;
vector<long long> m;
vector<long long> bef[10 * kk];
bool viv = false;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a != n - 1 && b != n - 1 || (a == b)) {
      cout << "NO";
      return 0;
    }
    if (a > b) swap(a, b);
    m.push_back(a);
  }
  sort(m.begin(), m.end());
  vector<long long> kol(n, 0);
  for (auto i : m) kol[i]++;
  for (i = 0; i < n; i++)
    if (kol[i] > i + 1) {
      cout << "NO";
      return 0;
    }
  vector<long long> st;
  vector<pair<long long, long long> > re;
  for (i = 0; i < n - 1; i++) {
    if (kol[i] == 0) st.push_back(i);
    if (kol[i] - 1 > st.size()) {
      cout << "NO";
      return 0;
    }
    if (kol[i] > 0) {
      long long j = kol[i] - 1;
      bef[i].push_back(n - 1);
      while (j) {
        bef[i].push_back(st.back());
        st.pop_back();
        j--;
      }
    }
  }
  for (i = 0; i < n; i++)
    if (!bef[i].empty()) {
      for (j = 1; j < bef[i].size(); j++)
        re.push_back({bef[i][j - 1], bef[i][j]});
      re.push_back({i, bef[i].back()});
    }
  cout << "YES" << endl;
  for (auto i : re) cout << i.second + 1 << ' ' << i.first + 1 << '\n';
  return 0;
}
