#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> v[100009];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 0; i < n; i++) {
    if (v[i].size() != 2) continue;
    puts("NO"), exit(0);
  }
  puts("YES");
}
