#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int in[N], n, u, v;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    scanf("%d", &u), scanf("%d", &v);
    ++in[u - 1];
    ++in[v - 1];
  }
  for (int i = 0; i < n; ++i)
    if (in[i] == 2) return puts("NO"), 0;
  puts("YES");
}
