#include <bits/stdc++.h>
using namespace std;
template <typename T>
using vc = vector<T>;
using pii = pair<long long, long long>;
void xmax(long long& a, long long b) { a = max(a, b); }
void xmin(long long& a, long long b) { a = min(a, b); }
void print(vc<long long>& a, string second) {
  cerr << second << " : ";
  for (long long i = 0; i < a.size(); i++) {
    cerr << a[i] << " ";
  }
  cerr << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vc<vc<long long> > adi(n);
  for (long long i = 0; i + 1 < n; ++i) {
    long long u, v;
    cin >> u >> v;
    u--;
    v--;
    adi[u].push_back(v);
    adi[v].push_back(u);
  }
  long long geht = 1;
  for (long long i = 0; i < n; i++) {
    if (adi[i].size() == 2) geht = 0;
  }
  if (geht) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}
