#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> g;
vector<int> used;
vector<int> tin;
vector<int> tout;
int timer = 0;
vector<int> seen;
void dfs(int cur) {
  if (g[cur].size() == 1) {
    seen.push_back(cur);
  }
  used[cur] = 1;
  for (auto t : g[cur]) {
    if (!used[t]) {
      dfs(t);
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  g.resize(n);
  vector<pair<int, int>> ed;
  for (int i = 0; i + 1 < n; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    ed.push_back({u, v});
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < n; i++) {
    if (g[i].size() == 2) {
      cout << "NO" << endl;
      exit(0);
    }
  }
  cout << "YES" << endl;
}
