#include <bits/stdc++.h>
using namespace std;
int main() {
  cout << fixed << setprecision(10);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int f[n + 1];
  memset(f, 0, sizeof f);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    ++f[u];
    ++f[v];
  }
  if (f[n] < n - 1 || f[n - 1] == 0) {
    cout << "NO";
    return 0;
  }
  vector<int> b, c;
  for (int i = n - 1; i > 0; i--) {
    if (f[i])
      b.push_back(i);
    else
      c.push_back(i);
  }
  int ans[n + 1];
  memset(ans, -1, sizeof ans);
  ans[1] = n;
  int p = 1;
  for (int e : b) {
    p += f[e];
    if (p > n) {
      cout << "NO";
      return 0;
    }
    ans[p] = e;
  }
  int ind = 0;
  for (int i = 1; i < n + 1; i++) {
    if (ans[i] == -1) ans[i] = c[ind++];
  }
  int post[n + 1];
  post[n] = ans[n];
  for (int i = n - 1; i > 0; i--) post[i] = max(ans[i], post[i + 1]);
  for (int i = 2; i < n + 1; i++) {
    if (f[ans[i]] && post[i - f[ans[i]] + 1] > ans[i]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES\n";
  for (int i = 1; i < n; i++) cout << ans[i] << ' ' << ans[i + 1] << '\n';
}
