#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int freq[n + 1];
  bool done[n + 1];
  for (int i = 1; i <= n; i++) freq[i] = 0;
  for (int i = 1; i <= n; i++) done[i] = false;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    freq[a]++;
    freq[b]++;
  }
  vector<vector<int> > tree;
  vector<int> temp;
  for (int i = 0; i <= n; i++) tree.push_back(temp);
  bool flag = true;
  for (int i = n - 1; i >= 1; i--) {
    if (freq[i] > i || (freq[i] && done[i])) {
      flag = false;
      break;
    }
    if (freq[i] == 0 && !done[i]) {
      flag = false;
      break;
    }
    if (freq[i] == 0 || done[i]) continue;
    done[i] = true;
    if (freq[i] == 1) {
      tree[n].push_back(i);
      continue;
    } else {
      int to_place = freq[i] - 1;
      for (int j = i - 1; j >= 1; j--) {
        if (done[j]) continue;
        if (freq[j] != 0) continue;
        tree[i].push_back(j);
        done[j] = true;
        to_place--;
        if (to_place == 0) break;
      }
      if (to_place) {
        flag = false;
        break;
      }
    }
  }
  if (!flag) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
    for (int i = 0; i < tree[n].size(); i++) {
      cout << n << " " << tree[n][i] << endl;
    }
    for (int i = n - 1; i >= 2; i--) {
      if (tree[i].size() == 0) continue;
      int prev = n;
      for (int j = 0; j < tree[i].size(); j++) {
        cout << prev << " " << tree[i][j] << endl;
        prev = tree[i][j];
      }
      cout << prev << " " << i << endl;
    }
  }
  return 0;
}
