#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7FFFFFFF;
const long long LINF = 0x7FFFFFFFFFFFFF;
void guan() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const long long mod = 1e9 + 7;
const int maxn = 202020;
typedef struct Node {
  int u, v;
  bool operator<(const struct Node& e) const {
    if (u == e.u) return v > e.v;
    return u > e.u;
  }
} node;
node a[maxn];
vector<int> g[maxn], id[maxn];
int vis[maxn];
queue<int> q;
pair<int, int> ans[maxn];
int main() {
  guan();
  int t;
  long long n, m, d, h;
  while (cin >> n) {
    memset(vis, 0, sizeof(vis));
    while (!q.empty()) q.pop();
    for (int i = 1; i <= n - 1; i++) {
      cin >> a[i].u >> a[i].v;
      vis[a[i].u] = 1;
      vis[a[i].v] = 1;
      if (a[i].u < a[i].v) swap(a[i].u, a[i].v);
    }
    sort(a + 1, a + n);
    for (int i = n; i >= 1; i--) {
      if (vis[i]) continue;
      q.push(i);
    }
    if (n > 1 && a[n - 1].u != n) {
      cout << "NO" << endl;
      continue;
    } else {
      int cnt = 0, ok = 1;
      for (int i = 1; i <= n - 1 && ok; i++) {
        vis[a[i].v] = 1;
        int u = n;
        while (a[i + 1].v == a[i].v && ok) {
          ans[++cnt] = pair<int, int>(u, q.front());
          if (q.front() > a[i].v) {
            ok = 0;
          }
          u = q.front();
          q.pop();
          i++;
        }
        ans[++cnt] = pair<int, int>(u, a[i].v);
      }
      if (ok) {
        cout << "YES" << endl;
        for (int i = 1; i <= cnt; i++)
          cout << ans[i].first << " " << ans[i].second << endl;
      } else {
        cout << "NO" << endl;
      }
    }
  }
  return 0;
}
