#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  int n, u, v, flag = 0;
  int a[100010];
  memset(a, 0, sizeof(a));
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    a[u]++;
    a[v]++;
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == 2) {
      flag = 1;
      break;
    }
  }
  if (flag == 1)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
