#include <bits/stdc++.h>
#pragma gcc optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
void fail() {
  cout << "NO\n";
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  ;
  vector<int> d(n, 0);
  for (__typeof(0) i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    ;
    d[u - 1]++;
    d[v - 1]++;
  }
  for (__typeof(0) i = 0; i < n; i++)
    if (d[i] == 2) fail();
  cout << "YES\n";
  return 0;
}
