#include <bits/stdc++.h>
using namespace std;
FILE* in = stdin;
FILE* out = stdout;
const int MAX = 1024;
int n;
int cnt[MAX];
bool used[MAX];
int nextNode = 1;
int getNext() {
  while (nextNode < n) {
    if (used[nextNode]) {
      nextNode++;
      continue;
    }
    break;
  }
  used[nextNode] = true;
  return nextNode;
}
int main(void) {
  fscanf(in, "%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int node1, node2;
    fscanf(in, "%d %d", &node1, &node2);
    if (node2 != n) {
      fprintf(out, "NO\n");
      return 0;
    }
    cnt[node1]++;
  }
  vector<pair<int, int> > ans;
  for (int node = 1; node < n; node++)
    if (cnt[node] > 0) {
      used[node] = true;
      int prev = node;
      while (cnt[node] > 1) {
        int next = getNext();
        if (next >= node) {
          fprintf(out, "NO\n");
          return 0;
        }
        ans.push_back(make_pair(prev, next));
        prev = next;
        cnt[node]--;
      }
      ans.push_back(make_pair(prev, n));
    }
  fprintf(out, "YES\n");
  for (int i = 0; i < (int)ans.size(); i++)
    fprintf(out, "%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
