#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, m;
int a[N], b[N], ok[N], use[N];
int ans1[N], ans2[N], cnt[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &a[i], &b[i]);
    if (a[i] > b[i]) swap(a[i], b[i]);
    if (b[i] != n || (a[i] == n && b[i] == n)) {
      return 0 * puts("NO");
    }
  }
  sort(a + 1, a + n);
  reverse(a + 1, a + n);
  int res = 0;
  for (int i = 1; i < n; ++i) {
    cnt[a[i]]++;
  }
  queue<int> Q;
  for (int i = 1; i < n; ++i)
    if (!cnt[i]) Q.push(i);
  for (int i = 1; i < n; ++i) {
    if (!cnt[i]) continue;
    int las = i;
    while (cnt[i] > 1) {
      int x = Q.front();
      Q.pop();
      if (x > i) return 0 * puts("NO");
      ++res;
      ans1[res] = x;
      ans2[res] = las;
      las = x;
      cnt[i]--;
    }
    ++res;
    ans1[res] = las;
    ans2[res] = n;
  }
  puts("YES");
  for (int i = 1; i < n; ++i) {
    printf("%d %d\n", ans1[i], ans2[i]);
  }
  return 0;
}
