#include <bits/stdc++.h>
using namespace std;
const int M = 200010;
int n, m, ro[M];
int main() {
  scanf("%d", &n);
  int x, y;
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &x, &y);
    ro[x]++;
    ro[y]++;
  }
  for (int i = 1; i <= n; ++i)
    if (ro[i] == 2) m = -1;
  if (m == -1)
    puts("NO");
  else
    puts("YES");
}
