#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int> > graph(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  set<int> S;
  for (int i = 0; i < n; i++) {
    if (graph[i].size() >= 3) {
      S.insert(i);
    }
  }
  if (S.size() >= 2) {
    cout << "No" << endl;
    return 0;
  }
  int root;
  if (S.size() == 0)
    root = 0;
  else
    root = *S.begin();
  stack<int> sta;
  bool visited[n + 2];
  memset(visited, false, sizeof visited);
  sta.push(root);
  visited[root] = true;
  vector<int> paths;
  while (!sta.empty()) {
    int deq = sta.top();
    sta.pop();
    if (graph[deq].size() == 1 && visited[graph[deq][0]]) paths.push_back(deq);
    for (int i = 0; i < graph[deq].size(); i++) {
      if (!visited[graph[deq][i]]) {
        visited[graph[deq][i]] = true;
        sta.push(graph[deq][i]);
      }
    }
  }
  cout << "Yes" << endl;
  cout << paths.size() << endl;
  for (int i = 0; i < paths.size(); i++) {
    cout << root + 1 << " " << paths[i] + 1 << endl;
  }
  return 0;
}
