#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int i, n, u, v;
  cin >> n;
  vector<int> neighbours[n];
  for (i = 0; i < n - 1; i++) {
    cin >> u >> v;
    neighbours[u - 1].push_back(v - 1);
    neighbours[v - 1].push_back(u - 1);
  }
  int cnt = 0;
  for (i = 0; i < n; i++) {
    cerr << i << ' ' << neighbours[i].size() << '\n';
    if (neighbours[i].size() > 1) cnt += (neighbours[i].size() <= 2);
  }
  cout << (cnt > 0 ? "NO\n" : "YES\n");
  return 0;
}
