#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
int n;
vector<int> color, parent;
vector<int> ans;
int acyclic = 1;
void dfs(int v) {
  ;
  color[v] = 1;
  for (int u : adj[v]) {
    if (color[u] == 0) {
      parent[u] = v;
      dfs(u);
    }
    if ((int)((adj[v]).size()) == 1) {
      ans.push_back(v);
    }
  }
  color[v] = 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(20);
  cin >> n;
  adj.resize(n + 2, vector<int>(0));
  color.resize(n + 1, 0);
  parent.resize(n + 1, -1);
  ;
  int p, q;
  for (int i = 0; i < n - 1; i++) {
    cin >> p >> q;
    adj[p].push_back(q);
    adj[q].push_back(p);
  }
  int cnt = 0;
  vector<int> mul;
  for (auto i = 1; i <= n; i++) {
    if ((int)((adj[i]).size()) > 2) {
      cnt++;
      mul.push_back(i);
    }
  };
  if (n == 2) {
    cout << "Yes" << endl;
    cout << 1 << endl;
    cout << p << ' ' << q << endl;
    return 0;
  }
  if (cnt > 1) {
    cout << "No" << endl;
    return 0;
  }
  if (cnt == 0) {
    dfs(p);
    cout << "Yes" << endl;
    cout << 1 << endl;
    cout << ans[0] << ' ' << ans[1] << endl;
    return 0;
  };
  dfs(mul[0]);
  cout << "Yes" << endl;
  cout << (int)((ans).size()) << endl;
  cout << ans[0] << ' ' << mul[0] << endl;
  for (auto i = 1; i <= (int)((ans).size()) - 1; i++) {
    cout << mul[0] << ' ' << ans[i] << endl;
  };
  return 0;
}
