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