#include <bits/stdc++.h>
using namespace std;
vector<int> X[100005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  int N;
  cin >> N;
  for (int i = 1; i <= N - 1; i++) {
    int u, v;
    cin >> u >> v;
    X[u].push_back(v);
    X[v].push_back(u);
  }
  int leaves = 0, connectors = 0;
  for (int i = 1; i <= N; i++) connectors += (X[i].size() == 2);
  if (connectors == 0)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
