#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 20;
const long long inf = 1e10;
int d[N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    d[u]++;
    d[v]++;
  }
  bool ok = true;
  int cntl = 0;
  for (int i = 1; i <= n; i++)
    if (d[i] == 2) ok = false;
  if (ok)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
