#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int INF = 1e9 + 5;
int cnt[MAXN + 5];
vector<int> useless, useful;
vector<pair<int, int> > ans;
void nope() {
  cout << "NO\n";
  exit(EXIT_SUCCESS);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N;
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    cnt[a]++;
    cnt[b]++;
    if (a != N && b != N) nope();
  }
  for (int i = 1; i < N; i++) {
    if (cnt[i] == 0)
      useful.push_back(i);
    else {
      if (useful.size() < cnt[i] - 1) nope();
      int root = i;
      for (int j = 0; j < cnt[i] - 1; j++) {
        int x = useful.back();
        ans.push_back({x, root});
        root = x;
        useful.pop_back();
      }
      useless.push_back(root);
    }
  }
  for (int x : useless) ans.push_back({N, x});
  cout << "YES\n";
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
}
