#include <bits/stdc++.h>
using namespace std;
const long long INF = 2000000000LL;
const long double EPS = 1e-9;
const int N = 1000 + 7;
int cnt[N];
vector<int> g[N];
int sz[N];
void nup() {
  cout << "NO"
       << "\n";
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  memset(cnt, 0, sizeof cnt);
  bool flag = true;
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    flag &= (u != v);
    ++cnt[u], ++cnt[v];
  }
  flag &= (cnt[n] == n - 1);
  if (!flag) nup();
  memset(sz, 0, sizeof sz);
  for (int i = n - 1; i > 0 and flag; --i) {
    int c = cnt[i];
    if (c > 0) {
      sz[i] = c;
      g[i].push_back(i);
    } else {
      bool pd = false;
      for (int j = i + 1; j < n; ++j) {
        if (g[j].size() < sz[j]) {
          g[j].push_back(i);
          pd = true;
          break;
        }
      }
      flag &= pd;
    }
  }
  if (!flag) nup();
  cout << "YES\n";
  for (int i = 1; i <= n; ++i) {
    if (g[i].empty()) continue;
    for (int j = 1; j < (int)g[i].size(); ++j) {
      cout << g[i][j - 1] << " " << g[i][j] << "\n";
    }
    cout << g[i].back() << " " << n << "\n";
  }
  return 0;
}
