#include <bits/stdc++.h>
using namespace std;
bool vis[1005];
int ans[1005], x[1005], y[1005], n, t = 1;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int main() {
  n = read();
  for (int i = 1; i < n; ++i) {
    x[i] = read(), y[i] = read();
    if (x[i] > y[i]) swap(x[i], y[i]);
    if (y[i] != n) return 0 * puts("NO");
  }
  sort(x + 1, x + n);
  for (int i = 1; i < n; ++i) {
    if (x[i] < i) return 0 * puts("NO");
    if (!vis[x[i]])
      ans[i] = x[i], vis[x[i]] = 1;
    else {
      while (vis[t]) t++;
      vis[t] = 1;
      ans[i] = t;
    }
  }
  ans[n] = n;
  puts("YES");
  for (int i = 1; i < n; ++i) printf("%d %d\n", ans[i], ans[i + 1]);
}
