#include <bits/stdc++.h>
using namespace std;
const int size = 1e5 + 4;
int in_deg[size] = {};
bool visit[size] = {};
vector<int> e[size] = {};
int p = 0, mxd = 0;
set<pair<int, int>> s;
void dfs(int node) {
  visit[node] = 1;
  if (e[node].size() == 1) {
    s.insert({p, node});
    return;
  }
  for (auto i : e[node]) {
    if (!visit[i]) dfs(i);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, mx_d = 0, whN = 0;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    in_deg[b]++;
    in_deg[a]++;
    e[a].push_back(b);
    e[b].push_back(a);
    mxd = max({mxd, in_deg[a], in_deg[b]});
  }
  for (int i = 1; i <= n; i++) {
    if (in_deg[i] > 2 && mxd == in_deg[i]) whN = i;
    if (in_deg[i] > 2) mx_d++;
  }
  if (mx_d > 1) return cout << "No" << endl, 0;
  p = whN;
  if (mx_d == 0) {
    vector<int> v;
    for (int i = 0; i < n; i++)
      if (in_deg[i + 1] == 1) v.push_back(i + 1);
    cout << "Yes" << endl;
    cout << 1 << endl;
    for (auto i : v) cout << i << " ";
    return 0;
  }
  dfs(whN);
  cout << "Yes" << endl;
  cout << s.size() << endl;
  for (auto i : s) {
    cout << i.first << " " << i.second << endl;
  }
}
