#include <bits/stdc++.h>
int n;
int degree[100010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int r1, r2;
    scanf("%d%d", &r1, &r2);
    degree[r1]++;
    degree[r2]++;
  }
  for (int i = 1; i <= n; i++) {
    if (degree[i] == 2) {
      printf("NO");
      return 0;
    }
  }
  printf("YES");
  return 0;
}
