#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 5;
int n, mk[N], cnt[N];
bool a[N][N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int x, y;
  for (int i = 1; i <= n - 1; i++) {
    cin >> x >> y;
    cnt[x]++, cnt[y]++;
  }
  if (cnt[n] != n - 1) {
    puts("NO");
    return 0;
  }
  bool flag = true;
  for (int i = 1; i <= n - 1; i++) {
    if (cnt[i] == 0) continue;
    int k = cnt[i], pre = n;
    for (int j = 1; j < i && k > 1; j++) {
      if (!mk[j]) {
        mk[j] = true;
        a[pre][j] = a[j][pre] = true;
        pre = j;
        k--;
      }
    }
    if (k == 1) {
      mk[i] = true;
      a[pre][i] = a[i][pre] = true;
    } else
      flag = false;
  }
  if (!flag)
    cout << "NO" << '\n';
  else {
    cout << "YES" << '\n';
    for (int i = 1; i <= n; i++)
      for (int j = i + 1; j <= n; j++)
        if (a[i][j]) cout << i << ' ' << j << '\n';
  }
  return 0;
}
