#include <bits/stdc++.h>
using namespace std;
long long du[1010];
int vis[1010];
vector<pair<long long, long long> > ans;
int main() {
  int n, i, j, a, b;
  cin >> n;
  for (i = 1; i < n; i++) {
    cin >> a >> b;
    du[a]++;
    du[b]++;
  }
  if (du[n] != n - 1) {
    cout << "NO" << endl;
    return 0;
  }
  long long last = n;
  for (i = n - 1; i >= 1; i--) {
    if (!du[i]) {
      if (vis[i]) continue;
      ans.push_back(make_pair(i, last));
    } else if (du[i] == 1)
      ans.push_back(make_pair(i, last));
    else {
      du[i]--;
      for (j = i - 1; j >= 1; j--) {
        if (!du[j] && !vis[j]) {
          ans.push_back(make_pair(last, j));
          last = j;
          du[i]--;
          vis[j] = 1;
          if (du[i] == 0) break;
        }
      }
      if (du[i]) {
        cout << "NO" << endl;
        return 0;
      }
      ans.push_back(make_pair(last, i));
    }
    last = i;
  }
  cout << "YES" << endl;
  for (i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
}
