#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> cnt(n);
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    cnt[a - 1]++;
    cnt[b - 1]++;
  }
  for (long long i = 0; i < n; i++) {
    if (cnt[i] == 2) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
}
signed main() {
  long long t;
  t = 1;
  while (t--) solve();
}
