#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7, inf = 1e9 + 3;
int main() {
  cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<vector<int> > g(n + 1, vector<int>());
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b), g[b].push_back(a);
  }
  bool ok = 1;
  for (int v = 1; v <= n; ++v) {
    if (g[v].size() == 2) ok = 0;
  }
  if (ok)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
