#include <bits/stdc++.h>
using namespace std;
int a[437984], t[437984];
bool vis[437984];
int main() {
  int n;
  cin >> n;
  int x, y;
  for (register int i = 1; i < n; i++) {
    cin >> x >> y;
    if (x > y) swap(x, y);
    if (y != n) {
      puts("NO");
      return 0;
    }
    a[i] = x;
  }
  sort(a + 1, a + n);
  a[n] = n;
  for (register int i = 1; i <= n; i++) {
    bool ff = 0;
    if (!vis[a[i]]) {
      t[i] = a[i];
      vis[a[i]] = 1;
      ff = 1;
    } else {
      for (register int j = 1; j < a[i]; j++)
        if (!vis[j]) {
          vis[j] = 1, t[i] = j, ff = 1;
          break;
        }
      if (!ff) {
        puts("NO");
        return 0;
      }
    }
  }
  puts("YES");
  for (register int i = 2; i <= n; i++) cout << t[i] << " " << t[i - 1] << endl;
  return 0;
}
