#include <bits/stdc++.h>
using namespace std;
bool sec(char &a, char &b) { return (int(a) < int(b)); }
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
void solve() {
  long long n, m = 0, t = 0, k = 0, x = 0, y = 0, sum = 0;
  vector<long long> a(100001, 0);
  cin >> m;
  long long l, r;
  for (long long i = 0; i < m - 1; i++) {
    cin >> l >> r;
    a[l]++;
    a[r]++;
  }
  if ((find((a).begin(), (a).end(), 2) != (a).end())) {
    cout << "NO";
  } else
    cout << "YES";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    solve();
  }
  return 0;
}
