#include <bits/stdc++.h>
const int maxn = 1003;
int n;
bool used[maxn];
int mp[maxn][maxn];
int edgeTot, edges[maxn << 1], nxt[maxn << 1], head[maxn];
int read() {
  char ch = getchar();
  int num = 0;
  bool fl = 0;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fl = 1;
  for (; isdigit(ch); ch = getchar()) num = (num << 1) + (num << 3) + ch - 48;
  if (fl) num = -num;
  return num;
}
void errorDown() {
  puts("NO");
  exit(0);
}
void addedge(int u, int v) {
  edges[++edgeTot] = v, nxt[edgeTot] = head[u], head[u] = edgeTot;
  edges[++edgeTot] = u, nxt[edgeTot] = head[v], head[v] = edgeTot;
}
void dfs(int x, int fa) {
  for (int i = head[x]; i != -1; i = nxt[i]) {
    int v = edges[i];
    if (v != fa) printf("%d %d\n", x, v), dfs(v, x);
  }
}
int main() {
  n = read();
  memset(head, -1, sizeof head);
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    if (u > v) std::swap(u, v);
    if (v != n) errorDown();
    mp[u][v]++;
  }
  for (int i = 1; i < n; i++)
    if (mp[i][n]) {
      if (i < mp[i][n]) errorDown();
      used[i] = 1;
      int lst = i, cnt = 0;
      for (int j = 1; j < i && cnt < mp[i][n] - 1; j++)
        if (!used[j]) {
          used[j] = 1;
          addedge(lst, j);
          lst = j;
          cnt++;
        }
      if (cnt != mp[i][n] - 1) errorDown();
      addedge(lst, n);
    }
  puts("YES");
  dfs(1, 0);
  return 0;
}
