#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
const int N = 100055;
const int MAX = 10000005;
int n;
int degree[N];
vector<vector<int> > graph(N);
bool check;
void init() {
  for (int i = 0; i < n; i++) {
    graph[i].clear();
    degree[i] = 0;
  }
}
set<pair<int, int> > dfs(int root, int par) {
  set<pair<int, int> > s;
  if (par != -1 && graph[root].size() > 2) check = false;
  for (int i = 0; i < graph[root].size(); i++) {
    if (graph[root][i] != par) {
      set<pair<int, int> > now = dfs(graph[root][i], root);
      s.insert(make_pair(root, (*now.begin()).second));
    }
  }
  if (graph[root].size() == 1 && par != -1) s.insert(make_pair(root, root));
  return s;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  init();
  int u, v;
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    u--;
    v--;
    graph[u].push_back(v);
    graph[v].push_back(u);
    degree[u]++;
    degree[v]++;
  }
  int maxdeg = degree[0];
  int root = 0;
  for (int i = 0; i < n; i++) {
    if (degree[i] > maxdeg) maxdeg = degree[i], root = i;
  }
  check = true;
  set<pair<int, int> > ans = dfs(root, -1);
  if (!check) {
    cout << "No"
         << "\n";
    ;
    return 0;
  }
  cout << "Yes"
       << "\n";
  ;
  cout << ans.size() << "\n";
  ;
  for (auto each : ans)
    cout << each.first + 1 << " " << each.second + 1 << "\n";
  ;
  return 0;
}
