#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 7;
int dis[maxn], n, fa[maxn], maxx = 0;
int s[maxn], tl = 0;
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    dis[min(x, y)]++;
    if (max(x, y) != n) {
      printf("NO\n");
      return 0;
    }
  }
  for (int i = 1; i < n; i++) {
    if (!dis[i]) s[++tl] = i;
    maxx = max(maxx, dis[i]);
  }
  for (int ss = 1; ss <= maxx; ss++) {
    for (int i = 1; i <= n; i++) {
      if (dis[i] != ss) continue;
      int num = 0, la = n;
      for (int j = tl; j >= 1; j--) {
        if (num < ss - 1 && s[j] != 0 && s[j] < i)
          fa[s[j]] = la, la = s[j], num++, s[j] = 0;
      }
      if (num != ss - 1) {
        printf("NO\n");
        return 0;
      }
      fa[i] = la;
    }
  }
  printf("YES\n");
  for (int i = 1; i < n; i++) printf("%d %d\n", i, fa[i]);
  return 0;
}
