#include <bits/stdc++.h>
using namespace std;
const int maxn = 500001;
const long long INF = 1e17 + 7;
const long double EPS = 1e-9;
const long double PI = 3.141592653589793;
int deg[maxn];
vector<int> g[maxn];
vector<vector<int>> ans;
void dfs(int v, int p) {
  ans.back().push_back(v);
  for (int to : g[v])
    if (to != p) dfs(to, v);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    deg[a]++;
    deg[b]++;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int cnt = 0;
  int ind = -1;
  for (int i = 1; i <= n; ++i) {
    if (deg[i] > 2) {
      ++cnt;
      ind = i;
    }
  }
  if (cnt > 1) {
    cout << "No";
    return 0;
  }
  if (cnt == 0) {
    ind = 1;
  }
  for (int to : g[ind]) {
    ans.push_back(vector<int>());
    ans.back().push_back(ind);
    dfs(to, ind);
  }
  cout << "Yes\n";
  cout << ans.size() << "\n";
  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i].front() << " " << ans[i].back() << "\n";
  }
}
