#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 13;
int n, deg[maxN];
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    deg[u]++;
    deg[v]++;
  }
  for (int i = 1; i <= n; i++)
    if (deg[i] == 2) return cout << "NO" << endl, 0;
  cout << "YES" << endl;
}
