#include <bits/stdc++.h>
using namespace std;
int deg[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, u, v;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    cin >> u >> v;
    deg[u]++;
    deg[v]++;
  }
  for (int i = 1; i <= n; i++) {
    if (deg[i] == 2) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  return 0;
}
