#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, -1, -1, 1, 1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
template <class T>
inline T biton(T n, T pos) {
  return n | ((T)1 << pos);
}
template <class T>
inline T bitoff(T n, T pos) {
  return n & ~((T)1 << pos);
}
template <class T>
inline T ison(T n, T pos) {
  return (bool)(n & ((T)1 << pos));
}
template <class T>
inline T gcd(T a, T b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
template <typename T>
string NumberToString(T Number) {
  ostringstream second;
  second << Number;
  return second.str();
}
inline int nxt() {
  int aaa;
  scanf("%d", &aaa);
  return aaa;
}
inline long long int lxt() {
  long long int aaa;
  scanf("%lld", &aaa);
  return aaa;
}
inline double dxt() {
  double aaa;
  scanf("%lf", &aaa);
  return aaa;
}
template <class T>
inline T bigmod(T p, T e, T m) {
  T ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % m;
    p = (p * p) % m;
  }
  return (T)ret;
}
int ar[1000010];
vector<int> v;
vector<pair<int, int> > edge;
int cnt[1000010];
int mark[1000010];
set<int> st;
int get(int x) {
  for (int i = x - 1; i >= 1; i--) {
    if (st.find(i) == st.end() && !mark[i]) {
      mark[i] = 1;
      return i;
    }
  }
  return -1;
}
int main() {
  int n = nxt();
  for (int i = 1; i < n; i++) {
    int a = nxt();
    int b = nxt();
    if (a > b) swap(a, b);
    if (b != n) {
      cout << "NO" << endl;
      return 0;
    }
    if (a == b && b == n) {
      cout << "NO" << endl;
      return 0;
    }
    st.insert(a);
    cnt[a]++;
    if (cnt[a] == 0) v.push_back(a);
  }
  for (int i = n - 1; i >= 1; i--) {
    vector<int> ok;
    if (cnt[i]) {
      ok.push_back(i);
      cnt[i]--;
      while (cnt[i]--) {
        int val = get(i);
        if (val == -1) {
          printf("NO\n");
          return 0;
        }
        ok.push_back(val);
      }
      sort(ok.begin(), ok.end());
      for (int i = 1; i < ok.size(); i++) {
        edge.push_back(make_pair(ok[i], ok[i - 1]));
      }
      edge.push_back(make_pair(n, ok[0]));
    }
  }
  if (edge.size() != n - 1) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  for (auto it : edge) {
    printf("%d %d\n", it.first, it.second);
  }
  return 0;
}
