#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
set<char> vowel = {'A', 'O', 'Y', 'E', 'U', 'I', 'a', 'o', 'y', 'e', 'u', 'i'};
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
long long n, m, k, l, ans = 0, res = 0, posmin, posmax, x, y, z, xmax = 0,
                      ymax = 0;
bool vis[100000];
char c, c1;
string ch, ch1, ch2;
deque<int> dq, dq1;
map<long long, long long> maa;
map<int, set<int> > adj;
map<pair<int, int>, vector<pair<int, int> > > mapai;
map<char, set<char> > edje;
set<char> setchar;
set<long long> sx, sy;
vector<int> v, vv;
vector<pair<int, int> > vvv;
void dfs(int src) {
  if (vis[src]) return;
  vis[src] = 1;
  if (adj[src].size() == 1) v.push_back(src);
  for (auto t : adj[src]) {
    dfs(t);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  memset(vis, false, sizeof(vis));
  ;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    x--;
    y--;
    adj[x].insert(y);
    adj[y].insert(x);
  }
  for (int i = 0; i < n; i++) {
    if (adj[i].size() >= 3) {
      posmin = i;
      res++;
    }
    if (adj[i].size() == 1) posmax = i;
  }
  if (res == 0) {
    dfs(posmax);
    cout << "Yes" << endl;
    cout << 1 << endl;
    cout << posmax + 1 << " " << v[v.size() - 1] + 1;
  } else if (res == 1) {
    dfs(posmin);
    cout << "Yes" << endl;
    cout << v.size() << endl;
    ;
    for (int i = 0; i < v.size(); i++) {
      cout << posmin + 1 << " " << v[i] + 1 << endl;
    }
  } else {
    cout << "No";
  }
  return 0;
}
