#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, u, v;
  int edge[200123] = {0};
  bool can = true;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    edge[u]++;
    edge[v]++;
  }
  for (int i = 1; i <= n && can; i++) {
    if (edge[i] == 2) can = false;
  }
  if (can)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
