#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("abm,fma,mmx,avx,popcnt,avx2,sse,sse2,sse3")
using namespace std;
unsigned Seeyouagain() {
  long long n;
  cin >> n;
  vector<long long> deg(n + 1, 0);
  for (long long i = 0; i < n - 1; ++i) {
    long long x, y;
    cin >> x >> y;
    --x, --y;
    ++deg[x], ++deg[y];
  }
  if (n == 2) return cout << "Yes\n1\n1 2", 0;
  long long root = -1, smax = INT64_MIN;
  for (long long i = 0; i < n; ++i) smax = max(smax, deg[i]);
  if (smax <= 2) {
    cout << "Yes\n1\n";
    for (long long i = 0; i < n; ++i) {
      if (deg[i] == 1) {
        cout << i + 1 << " ";
        for (long long ii = i + 1; ii < n; ++ii) {
          if (deg[ii] == 1) {
            cout << ii + 1;
            return 0;
          }
        }
      }
    }
  }
  set<long long> poss;
  for (long long i = 0; i < n; ++i) {
    if (deg[i] > 2) poss.insert(i);
  }
  if ((long long)poss.size() > 1) return cout << "No", 0;
  root = *poss.begin();
  cout << "Yes\n";
  vector<pair<long long, long long>> out;
  for (long long i = 0; i < n; ++i) {
    if (deg[i] == 1) {
      out.emplace_back(root + 1, i + 1);
    }
  }
  cout << (long long)out.size() << "\n";
  for (auto e : out) cout << e.first << " " << e.second << "\n";
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(!cin.tie(nullptr));
  long long testc = 1;
  while (testc--) {
    Seeyouagain();
    cout << "\n";
  }
  return 0;
}
