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