#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T Max(register T a, register T b) {
  return a > b ? a : b;
}
template <class T>
inline T Min(register T a, register T b) {
  return a < b ? a : b;
}
const int MAXN = 1005;
int n, t;
int a[MAXN], c[MAXN], vis[MAXN];
struct node {
  int u, v;
} e[MAXN << 1];
template <class T>
inline void read(T& x) {
  char ch = getchar();
  x = 0;
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
}
int main() {
  read(n);
  for (register int i = (1); i <= (n - 1); ++i) {
    int u, v;
    read(u), read(v);
    if (v != n) {
      puts("NO");
      return 0;
    }
    a[i] = u;
  }
  sort(a + 1, a + n);
  int now = 1;
  for (register int i = (1); i <= (n - 1); ++i) {
    if (a[i] < i) {
      puts("NO");
      return 0;
    }
    if (a[i] != a[i - 1])
      vis[a[i]] = 1, c[++t] = a[i];
    else {
      while (vis[now]) ++now;
      c[++t] = now;
      ++now;
    }
  }
  assert(t == n - 1);
  c[n] = n;
  puts("YES");
  for (register int i = (1); i <= (n - 1); ++i) {
    printf("%d %d\n", c[i], c[i + 1]);
  }
  return 0;
}
