#include <bits/stdc++.h>
using namespace std;
int long long n, i, j, s, f, cnt;
vector<int long long> my[100005];
vector<pair<int long long, int long long> > v;
void dfs(int long long x, int long long p, int long long y) {
  int long long j, to, z = y;
  if (my[x].size() == 1 && p != -1) {
    v.push_back({y, x});
  }
  if (my[x].size() > 2) {
    z = x;
    cnt++;
    if (cnt > 1) {
      cout << "No";
      exit(0);
    }
  }
  for (j = 0; j < my[x].size(); j++) {
    to = my[x][j];
    if (to != p) {
      dfs(to, x, z);
    }
  }
  if (my[x].size() > 2) v.push_back({x, y});
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (i = 1; i < n; i++) {
    int long long x, y;
    cin >> x >> y;
    my[x].push_back(y);
    my[y].push_back(x);
  }
  for (i = 1; i <= n; i++) {
    if (my[i].size() == 1) {
      dfs(i, -1, i);
      cout << "Yes\n" << v.size() << endl;
      for (j = 0; j < v.size(); j++) {
        cout << v[j].first << " " << v[j].second << endl;
      }
      return 0;
    }
  }
}
