#include <bits/stdc++.h>
using namespace std;
int toNumber(string s) {
  int Number;
  if (!(istringstream(s) >> Number)) Number = 0;
  return Number;
}
string toString(int number) {
  ostringstream ostr;
  ostr << number;
  return ostr.str();
}
long long MOD;
long long ele(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    return ele((a * a) % MOD, b / 2);
  } else {
    return ((a % MOD) * ele((a * a) % MOD, b / 2)) % MOD;
  }
}
long long mcd(long long a, long long b) {
  if (a == 0) return b;
  return mcd(b % a, a);
}
double d_abs(long a, long b) {
  if (a > b) {
    return a - b;
  }
  return b - a;
}
bool isPal(string x) {
  for (int i = 0; i < (int)(x.size()); i++) {
    if (x[i] != x[x.size() - i - 1]) return false;
  }
  return true;
}
string add(char x) {
  if (x == 'A') {
    return "AL";
  }
  if (x == 'L') {
    return "PACA";
  }
  if (x == 'P') {
    return "CP";
  }
  if (x == 'C') {
    return "PC";
  }
}
string dos(string s) {
  string ret = "";
  for (int i = 0; i < (int)(s.size()); i++) {
    ret += add(s[i]);
  }
  return ret;
}
void solve(int caso) {
  int n;
  cin >> n;
  map<int, int> otro;
  for (int i = 0; i < (int)(n - 1); i++) {
    int a, b;
    cin >> a >> b;
    if (b != n) {
      cout << "NO" << endl;
      return;
    }
    otro[a]++;
  }
  set<int> puse;
  if (n == 2) {
    cout << "YES\n1 2\n";
    return;
  }
  int comp = 0;
  int pongo = 1;
  vector<pair<int, int> > ejes;
  for (map<int, int>::iterator it = otro.begin(); it != otro.end(); it++) {
    int prev = n;
    while (puse.find(pongo) != puse.end()) pongo++;
    for (int j = 0; j < (int)((it->second) - 1); j++) {
      if (pongo >= (it->first)) {
        cout << "NO";
        return;
      }
      ejes.push_back(make_pair(prev, pongo));
      prev = pongo;
      puse.insert(prev);
      puse.insert(pongo);
      pongo++;
      while (puse.find(pongo) != puse.end()) pongo++;
    }
    ejes.push_back(make_pair(prev, (it->first)));
    puse.insert(prev);
    puse.insert((it->first));
  }
  printf("YES\n");
  for (int i = 0; i < (int)(n - 1); i++) {
    printf("%d %d\n", ejes[i].first, ejes[i].second);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int T;
  T = 1;
  for (int i = 0; i < (int)(T); i++) {
    solve(i);
  }
}
