#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, u, v;
  cin >> n;
  std::map<long long, long long> m;
  while (--n) {
    cin >> u >> v;
    m[u]++;
    m[v]++;
  }
  for (auto it = m.begin(); it != m.end(); it++) {
    if (it->second == 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
