#include <bits/stdc++.h>
using namespace std;
double max(double a, double b) {
  if (a > b) return a;
  return b;
}
double min(double a, double b) {
  if (a < b) return a;
  return b;
}
map<long long, long long> mp;
vector<int> v[500005];
bool visited[500005];
bool dfs(int node, int parent) {
  visited[node] = true;
  bool flag = true;
  if (v[node].size() > 2)
    return false;
  else
    for (int i = 0; i < v[node].size(); i++)
      if (!visited[v[node][i]]) flag = dfs(v[node][i], node);
  return flag;
}
vector<int> nodes;
void dfs2(int node) {
  visited[node] = true;
  if (v[node].size() == 1) {
    nodes.push_back(node);
    return;
  }
  for (int i = 0; i < v[node].size(); i++) {
    if (!visited[v[node][i]]) dfs2(v[node][i]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  int a, b;
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  int maxm = 0, node = -1;
  for (int i = 1; i <= n; i++) {
    if (v[i].size() > maxm) {
      maxm = v[i].size();
      node = i;
    }
  }
  if (n == 2) {
    cout << "Yes\n";
    cout << "1\n";
    cout << node << " " << v[node][0];
    return 0;
  }
  visited[node] = true;
  bool temp = true;
  for (int i = 0; i < v[node].size(); i++) {
    temp = dfs(v[node][i], node);
    if (!temp) break;
  }
  memset(visited, false, sizeof(visited));
  if (!temp)
    cout << "No\n";
  else {
    cout << "Yes\n";
    dfs2(node);
    cout << nodes.size() << "\n";
    for (int i = 0; i < nodes.size(); i++)
      cout << node << " " << nodes[i] << "\n";
  }
  return 0;
}
