#include <bits/stdc++.h>
using namespace std;
vector<int> Deg;
int main() {
  ios_base::sync_with_stdio(0);
  int n, a, b;
  cin >> n;
  Deg.resize(n + 1, 0);
  for (int i = 1; i <= n - 1; i++) {
    cin >> a >> b;
    Deg[a]++;
    Deg[b]++;
  }
  for (int i = 1; i <= n; i++) {
    if (Deg[i] == 2) {
      cout << "NO"
           << "\n";
      return 0;
    }
  }
  cout << "YES"
       << "\n";
  return 0;
}
