#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v[n + 1];
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 1; i < n + 1; i++) {
    if (v[i].size() < 3 && v[i].size() > 1) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
}
