#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
int num = 0;
bool flag = 1;
int main() {
  int i, j;
  int a, b;
  int len;
  int n;
  cin >> n;
  for (i = 1; i <= n - 1; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (i = 1; i <= n; i++)
    if (v[i].size() == 2) flag = 0;
  if (!flag)
    printf("NO");
  else
    printf("YES");
}
