#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
int n;
pair<int, int> e[200005];
int deg[200005];
vector<int> Adj[200005];
void solve();
int main() { solve(); }
void solve() {
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    cin >> u >> v;
    e[i] = {u, v};
    Adj[u].push_back(v);
    Adj[v].push_back(u);
  }
  for (int i = 1; i <= n - 1; i++) {
    int u = e[i].first, v = e[i].second;
    int c = 0, d = 0;
    if (Adj[u].size() - 1 == 1) {
      cout << "NO";
      return;
    }
    if (Adj[v].size() - 1 == 1) {
      cout << "NO";
      return;
    }
  }
  cout << "YES";
}
