#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
long long disjecnt[100007];
int main() {
  long long k, num, m, tc, t = 1;
  scanf("%lld", &num);
  for (long long i = 1; i < num; i++) {
    long long u, v;
    scanf("%lld %lld", &u, &v);
    disjecnt[u]++;
    disjecnt[v]++;
  }
  for (long long i = 1; i <= num; i++) {
    if (disjecnt[i] == 2) {
      return cout << "NO" << endl, 0;
    }
  }
  cout << "YES" << endl;
}
