#include <bits/stdc++.h>
using namespace std;
long long mod_exp(long long x, long long y, long long mm) {
  if (y == 0)
    return (1);
  else if (y % 2 == 0)
    return (mod_exp((x * x) % mm, y / 2, mm));
  else
    return ((x * mod_exp((x * x) % mm, (y - 1) / 2, mm)) % mm);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int arr[n + 1];
  memset(arr, 0, sizeof(arr));
  for (int i = 1; i < n; i++) {
    int v, u;
    cin >> v >> u;
    arr[v]++;
    arr[u]++;
  }
  for (int i = 1; i <= n; i++) {
    if (arr[i] == 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES"
       << "\n";
  return 0;
}
