#include <bits/stdc++.h>
using namespace std;
const int maxM = 1000010;
vector<vector<int>> adj(maxM);
int deg[maxM];
bool been[maxM];
int start, finish, M;
bool first = 1;
void dest(int u) {
  if (been[u]) return;
  been[u] = 1;
  for (int i = 0; i < adj[u].size(); i++) {
    dest(adj[u][i]);
  }
  if (first) {
    finish = u;
    first = 0;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> M;
  memset(deg, 0, sizeof(deg));
  unordered_set<int> seen;
  int u, v, cnt = 0, base;
  for (int i = 0; i < M - 1; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    deg[u]++;
    deg[v]++;
    if (deg[u] > 2) {
      base = u;
      if (seen.find(u) == seen.end()) {
        base = u;
        cnt++;
        if (cnt > 1) {
          cout << "No" << endl;
          return 0;
        }
      }
      seen.insert(u);
    }
    if (deg[v] > 2) {
      base = v;
      if (seen.find(v) == seen.end()) {
        cnt++;
        if (cnt > 1) {
          cout << "No" << endl;
          return 0;
        }
      }
      seen.insert(v);
    }
  }
  cout << "Yes" << endl;
  memset(been, 0, sizeof(been));
  if (cnt == 0) {
    for (int i = 0; i < M; i++) {
      if (deg[i] == 1) {
        start = i;
        break;
      }
    }
    dest(start);
    cout << 1 << endl << start << " " << finish << endl;
    return 0;
  }
  cout << deg[base] << endl;
  been[base] = 1;
  for (int i = 0; i < adj[base].size(); i++) {
    cout << base;
    first = 1;
    dest(adj[base][i]);
    cout << " " << finish << endl;
  }
  return 0;
}
