#include <bits/stdc++.h>
using namespace std;
vector<long long int> a[100005];
void solve() {
  long long n;
  cin >> n;
  for (long long int i = 1; i < n; i++) {
    long long u, v;
    cin >> u >> v;
    a[u].push_back(v);
    a[v].push_back(u);
  }
  long long f = 1;
  for (long long int i = 1; i < n + 1; i++) {
    if ((long long int)a[i].size() == 2) {
      cout << "NO";
      return;
    }
  }
  cout << "YES";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    solve();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
