#include <bits/stdc++.h>
using namespace std;
long long modx(long long Base, long long exponent) {
  long long ans = 1;
  if (Base == 1) return Base;
  while (exponent) {
    if (exponent & 1) ans = (ans * Base) % 1000000007LL;
    Base = (Base * Base) % 1000000007LL;
    exponent = exponent >> 1;
  }
  return ans;
}
long long inmodx(long long num) { return (modx(num, 1000000007LL - 2LL)); }
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return (a.first * a.second >= b.first * b.second);
}
const int N = (1e3) + 9;
const int M = (N << 2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 600;
pair<int, int> p[N];
int arr[N], cnt[N], ar[N];
vector<pair<int, int> > v[N];
bool mark[N];
void solve() {
  int n, i, a, b, j;
  cin >> n;
  for (i = (1); i < (n); i++) {
    cin >> a >> b;
    if (a > b) swap(a, b);
    p[i] = make_pair(a, b);
  }
  for (i = (1); i < (n); i++)
    if (p[i].second < n) {
      cout << "NO\n";
      return;
    }
  for (i = (1); i < (n); i++) ar[i] = p[i].first;
  sort(ar + 1, ar + n);
  for (i = (1); i < (n); i++) cnt[ar[i]]++;
  for (i = (1); i < (n); i++) {
    if (cnt[i] > 0) {
      arr[i] = i;
      cnt[i]--;
    } else {
      for (j = (i + 1); j < (n); j++)
        if (cnt[j] > 1) {
          arr[i] = j;
          cnt[j]--;
          break;
        }
    }
  }
  for (i = (1); i < (n); i++)
    if (arr[i] == 0) {
      cout << "NO\n";
      return;
    }
  cout << "YES\n";
  for (i = (1); i < (n); i++) {
    if (v[arr[i]].empty())
      v[arr[i]].push_back(make_pair(i, n));
    else
      v[arr[i]].push_back(make_pair(i, v[arr[i]].back().first));
  }
  for (i = (1); i < (n); i++)
    for (auto x : v[i]) cout << x.first << " " << x.second << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1, cs;
  cout << fixed << setprecision(9);
  for (cs = (1); cs < (t + 1); cs++) {
    solve();
  }
  return 0;
}
