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