#include <bits/stdc++.h>
using namespace std;
const double g = 9.8;
const double pi = acos(-1.0);
const int N = 2e5 + 10;
const int M = 2e5 + 10;
const int INF = 1e9 + 10;
const int mod = 998244353;
const int BLOCK = N;
unsigned int Table[N];
int n;
pair<int, int> p[N];
struct Edge {
  int a, b, c;
  bool friend operator<(Edge aa, Edge bb) { return aa.c > bb.c; }
} edge[N];
pair<int, int> ans[N];
set<int> can;
set<int>::iterator it;
int main() {
  scanf("%d", &n);
  int fg = 0;
  for (int i = 1; i < n; ++i) {
    can.insert(i);
    scanf("%d%d", &p[i].first, &p[i].second);
    if (p[i].first < p[i].second) swap(p[i].second, p[i].first);
    edge[i].a = p[i].first;
    edge[i].b = p[i].second;
    edge[i].c = p[i].first - p[i].second;
    if (p[i].first != n) fg = 1;
  }
  if (fg) return 0 * puts("NO");
  sort(edge + 1, edge + n);
  int cnt = 0;
  for (int i = 1; i < n;) {
    int j;
    for (j = i; j < n && edge[j].b == edge[i].b; ++j) {
    }
    if (j == i + 1) {
      ans[++cnt].first = edge[i].a;
      ans[cnt].second = edge[i].b;
      can.erase(edge[i].b);
    } else {
      int num = j - i;
      int last = n;
      while (num--) {
        it = can.begin();
        int now = *it;
        if (now > edge[i].b) {
          return 0 * puts("NO");
        }
        if (num == 0) {
          ans[++cnt].first = edge[i].b;
          ans[cnt].second = last;
          can.erase(edge[i].b);
          break;
        }
        can.erase(*it);
        ans[++cnt].first = now;
        ans[cnt].second = last;
        last = now;
      }
    }
    i = j;
  }
  if (fg) return 0 * puts("NO");
  puts("YES");
  for (int i = 1; i <= cnt; ++i) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
}
