#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int p[MAXN];
int sol[MAXN];
int inp[MAXN];
int t[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    inp[i] = u;
    if (v != n) return 0 * puts("NO");
    p[u]++;
  }
  sort(inp + 1, inp + n);
  sol[n] = n;
  int places = 0;
  int fl = n;
  for (int i = n - 1; i >= 1; i--) {
    if (p[i] == 0) continue;
    fl -= p[i];
    sol[fl] = i;
  }
  vector<int> empties;
  for (int i = 1; i <= n - 1; i++)
    if (p[i] == 0) empties.push_back(i);
  for (int i = n - 1; i >= 1; i--)
    if (sol[i] == 0) {
      sol[i] = empties.back();
      empties.pop_back();
    }
  int mx = 0;
  for (int i = 1; i < n; i++) {
    mx = max(mx, sol[i]);
    t[i] = mx;
  }
  for (int i = 1; i < n; i++)
    if (inp[i] - t[i]) return 0 * puts("NO");
  puts("YES");
  for (int i = 1; i < n; i++) printf("%d %d\n", sol[i], sol[i + 1]);
  return 0;
}
