#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 7;
long long n;
vector<long long> g[N];
long long d[N], mrk[N];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n;
  for (long long i = 1; i <= n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
    d[a]++, d[b]++;
  }
  for (long long i = 1; i <= n; i++) {
    if (d[i] == 1 || d[i] >= 3) continue;
    return cout << "NO", 0;
  }
  cout << "YES";
  return 0;
}
