#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 5;
int idx1[maxn], idx2[maxn], arr[maxn], A[maxn], n, pos;
bool cmp(int i, int j) { return idx1[i] < idx1[j]; }
inline bool insert(int x, int h) {
  for (int i = h; i <= n; ++i)
    if (!arr[i]) {
      arr[i] = x;
      return true;
    }
  return false;
}
inline void fail() {
  printf("NO");
  exit(0);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &idx1[i], &idx2[i]);
    A[i] = i;
    if (idx1[i] > idx2[i]) swap(idx1[i], idx2[i]);
  }
  sort(A + 1, A + n, cmp);
  arr[n] = n;
  for (int i = n - 1; i >= 1; --i) {
    int cur = A[i], pre = A[i - 1];
    if (idx1[cur] == n || idx2[cur] != n) fail();
    if (idx1[cur] != idx1[pre]) {
      arr[i] = idx1[cur];
      int a = idx1[pre] + 1, pos = i + 1;
      while (a < idx1[cur]) {
        if (!insert(a, pos)) fail();
        ++a;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    if (!arr[i]) fail();
  printf("YES\n");
  for (int i = 1; i < n; ++i) printf("%d %d\n", arr[i], arr[i + 1]);
  return 0;
}
