#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 9;
int cnt[maxn];
int mark[maxn];
vector<int> V[maxn], ans;
bool vis[maxn] = {0};
void dfs(int cur, int last) {
  vis[cur] = 1;
  if (V[cur].size() == 1 && V[cur][0] == last) {
    ans.push_back(cur);
    return;
  }
  for (int i = 0; i < V[cur].size(); i++) {
    if (!vis[V[cur][i]]) dfs(V[cur][i], cur);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    V[a].push_back(b);
    V[b].push_back(a);
    cnt[a]++;
    cnt[b]++;
  }
  for (int i = 1; i <= n; i++) {
    mark[i] = cnt[i];
  }
  sort(cnt + 1, cnt + n + 1);
  if (cnt[n - 1] >= 3)
    printf("No\n");
  else {
    int flag;
    for (int i = 1; i <= n; i++) {
      if (mark[i] == cnt[n]) {
        flag = i;
        break;
      }
    }
    dfs(flag, 0);
    printf("Yes\n");
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); i++) printf("%d %d\n", flag, ans[i]);
  }
  ans.clear();
  return 0;
}
