#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > graph;
vector<long long> used;
vector<long long> step;
long long dfs(long long v) {}
signed main() {
  long long n;
  cin >> n;
  step.resize(n);
  graph.resize(n);
  for (long long i = 0; i < n - 1; ++i) {
    long long x, y;
    cin >> x >> y;
    x--;
    y--;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  bool f = false;
  for (long long i = 0; i < n; ++i) {
    if (graph[i].size() == 2) {
      f = true;
    }
  }
  if (f) {
    cout << "NO";
  } else {
    cout << "YES";
  }
}
