#include <bits/stdc++.h>
using namespace std;
void file_io() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
void PLAY() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
}
int main() {
  PLAY();
  int n;
  cin >> n;
  int x[1000000] = {0};
  for (int i = 0; i < n - 1; i++) {
    int l, r;
    cin >> l >> r;
    x[l]++;
    x[r]++;
  }
  for (int i = 1; i <= n; i++) {
    if (x[i] == 2) return cout << "NO", 0;
  }
  cout << "YES";
}
