#include <bits/stdc++.h>
using namespace std;
const long long inf = 10000000000000;
const long long N = 2e5;
bool comp(pair<pair<long long, long long>, long long> a,
          pair<pair<long long, long long>, long long> b) {
  return a.second < b.second;
}
signed main() {
  long long n;
  cin >> n;
  long long deg[n];
  fill(deg, deg + n, 0);
  for (long long i = 0; i < n - 1; ++i) {
    long long x, y;
    cin >> x >> y;
    deg[--x]++;
    deg[--y]++;
  }
  for (long long i = 0; i < n; ++i) {
    if (deg[i] == 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
