#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8, pi = acos(-1);
const int SZ = 100050, INF = 0x7FFFFFFF;
vector<int> mp[SZ];
int res, pos;
int in[SZ];
void dfs(int u, int par) {
  int cur = 0;
  for (int i = 0; i < mp[u].size(); ++i) {
    int to = mp[u][i];
    if (to != par) {
      ++cur;
      dfs(to, u);
    }
  }
  if (par == -1 && cur == 2) --cur;
  if (cur > 1) {
    pos = u;
    ++res;
  }
}
int main() {
  std::ios::sync_with_stdio(0);
  int casenum;
  {
    int n;
    cin >> n;
    for (int i = 0; i < n - 1; ++i) {
      int u, v;
      cin >> u >> v;
      mp[u].push_back(v);
      mp[v].push_back(u);
      ++in[u];
      ++in[v];
    }
    dfs(1, -1);
    if (res > 1)
      cout << "No" << endl;
    else if (res == 0) {
      cout << "Yes\n1" << endl;
      vector<int> tmp;
      for (int i = 1; i <= n; ++i) {
        if (in[i] == 1) {
          tmp.push_back(i);
        }
      }
      cout << tmp[0] << " " << tmp[1] << endl;
    } else {
      cout << "Yes" << endl;
      int num = count(in + 1, in + 1 + n, 1);
      cout << num << endl;
      for (int i = 1; i <= n; ++i) {
        if (in[i] == 1) cout << i << " " << pos << endl;
      }
    }
  }
  return 0;
}
