#include <bits/stdc++.h>
using namespace std;
int cnt[100010];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    ++cnt[a];
    ++cnt[b];
  }
  for (int i = 0; i <= n; ++i) {
    if (cnt[i] == 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
