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