#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long arr[n - 1][2];
  long long maxNode = 0;
  map<long long, long long> numOcc;
  for (int i = 0; i < n - 1; i++) {
    cin >> arr[i][0] >> arr[i][1];
    arr[i][0]--;
    arr[i][1]--;
    if (arr[i][0] > arr[i][1]) {
      swap(arr[i][0], arr[i][1]);
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (arr[i][1] != n - 1) {
      cout << "NO" << endl;
      return 0;
    } else {
      numOcc[arr[i][0]]++;
    }
  }
  vector<pair<long long, long long> > myVec;
  long long currUnused = 0;
  for (auto it : numOcc) {
    if (it.second == 0) continue;
    while (numOcc[currUnused] > 0) currUnused++;
    long long currNode = n - 1;
    for (int i = 0; i < it.second - 1; i++) {
      if (currUnused > it.first) {
        cout << "NO" << endl;
        return 0;
      }
      myVec.push_back({currNode, currUnused});
      currNode = currUnused;
      currUnused++;
      while (numOcc[currUnused] > 0) currUnused++;
    }
    myVec.push_back({currNode, it.first});
  }
  cout << "YES" << endl;
  for (int i = 0; i < myVec.size(); i++) {
    cout << myVec[i].first + 1 << " " << myVec[i].second + 1 << endl;
  }
}
