#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 2e3 + 10;
int vis[maxn];
int cnt[maxn];
int x[maxn], y[maxn];
int ansx[maxn], ansy[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    scanf("%d %d", x + i, y + i);
    vis[x[i]] = 1;
    vis[y[i]] = 1;
    ++cnt[x[i]];
    ++cnt[y[i]];
  }
  if (cnt[n] != n - 1) {
    puts("NO");
    return 0;
  }
  int len = 0;
  for (int i = 1; i < n; ++i) {
    if (vis[i] && cnt[i]) {
      int pre = i;
      for (int j = i - 1; j >= 1; --j) {
        if (!vis[j] && cnt[i] > 1) {
          --cnt[i];
          vis[j] = 1;
          ansx[++len] = j;
          ansy[len] = pre;
          pre = j;
        }
      }
      if (cnt[i] == 1) {
        ansx[++len] = pre;
        ansy[len] = n;
        --cnt[i];
      }
    }
  }
  int temp = 0;
  for (int i = 1; i < n; ++i) {
    if (cnt[i] != 0) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  for (int i = 1; i < n; ++i) {
    printf("%d %d\n", ansx[i], ansy[i]);
  }
  return 0;
}
