#include <bits/stdc++.h>
using namespace std;
int i, i0, n, m;
vector<int> mp[100005];
int main() {
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    mp[x].push_back(y);
    mp[y].push_back(x);
  }
  bool f = 1;
  for (i = 1; i <= n; i++) {
    int x = mp[i][0];
    if (mp[x].size() == 2) {
      f = 0;
    }
  }
  printf("%s\n", f ? "YES" : "NO");
  return 0;
}
