#include <bits/stdc++.h>
using namespace std;
vector<int> nei[100010];
bool seen[100010];
vector<pair<int, int> > ans;
int dfs(int x) {
  seen[x] = true;
  if (nei[x].size() > 2) return -1;
  for (int n : nei[x]) {
    if (seen[n]) continue;
    return dfs(n);
  }
  return x;
}
int main() {
  int centroid = -1;
  int maxSize = 0;
  int N;
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int u, v;
    cin >> u >> v;
    nei[u].push_back(v);
    nei[v].push_back(u);
  }
  for (int i = 1; i <= N; i++) {
    seen[i] = false;
    if (nei[i].size() > maxSize) {
      centroid = i;
      maxSize = nei[i].size();
    }
  }
  seen[centroid] = true;
  for (int n : nei[centroid]) {
    int out = dfs(n);
    if (out == -1) {
      cout << "No" << '\n';
      return 0;
    }
    ans.push_back(make_pair(centroid, out));
  }
  cout << "Yes" << '\n';
  cout << ans.size() << '\n';
  for (pair<int, int> p : ans) {
    cout << p.first << ' ' << p.second << '\n';
  }
  return 0;
}
