#include <bits/stdc++.h>
using namespace std;
const int M = 1005;
struct sd {
  int a, b;
} ed[M];
int n, flag;
vector<int> cot[M];
vector<int> ans[M];
bool vis[M];
void in() { scanf("%d", &n); }
void ac() {
  int a, b;
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &a, &b);
    if (i == 1 && a == 38) flag = 1;
    if (a != n && b != n) puts("NO"), exit(0);
    cot[a].push_back(i);
    cot[b].push_back(i);
    vis[a] = vis[b] = 1;
  }
  for (int i = 1; i < n; ++i) {
    if (!cot[i].size()) continue;
    ans[i].push_back(n);
    for (int j = i - 1; j >= 1; --j) {
      if (ans[i].size() == cot[i].size()) break;
      if (!vis[j]) ans[i].push_back(j), vis[j] = 1;
    }
    if (ans[i].size() != cot[i].size()) {
      puts("NO");
      exit(0);
    }
    ans[i].push_back(i);
  }
  puts("YES");
  for (int i = 1; i < n; ++i) {
    if (!ans[i].size()) continue;
    for (int j = 0; j < cot[i].size(); ++j)
      ed[cot[i][j]] = (sd){ans[i][j], ans[i][j + 1]};
  }
  for (int i = 1; i < n; ++i) printf("%d %d\n", ed[i].a, ed[i].b);
}
int main() {
  in();
  ac();
}
