#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long arr[n + 1];
  memset(arr, 0, sizeof(arr));
  for (long long i = 0; i < n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    arr[x]++;
    arr[y]++;
  }
  bool check = true;
  for (long long i = 1; i <= n; i++) {
    if (arr[i] == 2) {
      check = false;
      break;
    }
  }
  if (check)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
