#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const long long mod = 1e9 + 7;
int book[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    book[a]++;
    book[b]++;
  }
  int fla = 1;
  for (int i = 1; i <= n; i++)
    if (book[i] == 2) fla = 0;
  if (fla)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
