#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n - 1; ++i) {
    long long u, v;
    cin >> u >> v;
    a[u - 1]++;
    a[v - 1]++;
  }
  for (int i = 0; i < n; ++i) {
    if (a[i] == 2) return cout << "NO", 0;
  }
  cout << "YES";
  return 0;
}
