#include <bits/stdc++.h>
using namespace std;
int d[100005];
int main() {
  memset(d, 0, sizeof(d));
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    d[x]++;
    d[y]++;
  }
  bool flag = false;
  for (int i = 1; i <= n; i++)
    if (d[i] == 2) flag = true;
  if (flag) {
    puts("NO");
  } else
    puts("YES");
  return 0;
}
