#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read() {
  T result;
  cin >> result;
  return result;
}
int main() {
  int32_t count = read<int32_t>();
  int32_t degree[count];
  memset(degree, 0, sizeof(degree));
  for (int32_t edge = 0; edge < count - 1; edge++) {
    int32_t start = read<int32_t>(), end = read<int32_t>();
    degree[start - 1]++;
    degree[end - 1]++;
  }
  for (int32_t node = 0; node < count; node++) {
    if (degree[node] == 2) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
