#include <bits/stdc++.h>
using namespace std;
const int maxn = 1006;
struct lpl {
  int a, b;
};
int n, a[maxn], b[maxn];
int f[maxn];
int vis[maxn];
vector<lpl> ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &a[i], &b[i]);
    if (a[i] == b[i]) {
      printf("NO");
      return 0;
    }
    if (a[i] != n && b[i] != n) {
      printf("NO");
      return 0;
    }
    if (a[i] < b[i]) swap(a[i], b[i]);
    f[b[i]]++;
  }
  for (int i = 1; i < n; ++i) {
    if (f[i] == 1) {
      ans.push_back((lpl){n, i});
      vis[i] = true;
    } else {
      if (f[i] > 1) {
        int qqq = f[i] - 1;
        int shang = n;
        for (int j = 1; j < i; ++j) {
          if (!vis[j]) {
            ans.push_back((lpl){shang, j});
            vis[j] = 1;
            shang = j;
            qqq--;
            if (!qqq) break;
          }
        }
        if (qqq) {
          printf("NO");
          return 0;
        }
        ans.push_back((lpl){shang, i});
        vis[i] = 1;
      }
    }
  }
  printf("YES\n");
  for (int i = ans.size() - 1; i >= 0; --i) {
    printf("%d %d\n", ans[i].a, ans[i].b);
  }
  return 0;
}
