#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> A = vector<int>(n);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    ++A[u], ++A[v];
  }
  for (int i = 0; i < n; ++i) {
    if (A[i] == 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
