#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int dig[N];
void solve() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    dig[a]++;
    dig[b]++;
  }
  for (int i = 1; i <= n; i++) {
    if (dig[i] == 2) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
}
int32_t main() {
  int tt;
  tt = 1;
  int cas = 1;
  while (tt--) {
    solve();
  }
}
