#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 12;
int a[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[x]++;
    a[y]++;
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == 2) {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
}
