#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  int* a = (int*)calloc(n + 1, sizeof(int));
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    ++a[u];
    ++a[v];
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == 2) {
      std::cout << "NO\n";
      return 0;
    }
  }
  std::cout << "YES\n";
  return 0;
}
