#include <bits/stdc++.h>
static int n, cnt[100000 + 10];
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    cnt[u]++;
    cnt[v]++;
  }
  int m = 0;
  for (int i = 1; i <= n; i++) {
    if (cnt[i] == 1) m++;
    if (cnt[i] == 2) return puts("NO"), 0;
  }
  if (1LL * m * (m - 1) / 2 >= n - 1)
    puts("YES");
  else
    puts("NO");
  return 0;
}
