#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int read() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * w;
}
vector<int> v[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int a, b;
    a = read();
    b = read();
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 1; i <= n; ++i) {
    if (v[i].size() == 2) {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  return 0;
}
