#include <bits/stdc++.h>
using namespace std;
long long n;
void solve() {}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long test = 1;
  while (test--) {
    map<int, int> cnt;
    long long x, y;
    cin >> n;
    for (long long i = 0; i < (n - 1); ++i) {
      cin >> x >> y;
      cnt[x]++;
      cnt[y]++;
    }
    long long ans = 0;
    for (auto i : cnt)
      if (i.second == 2) {
        cout << "NO\n";
        return 0;
      }
    cout << "YES\n";
    solve();
  }
}
