#include <bits/stdc++.h>
using namespace std;
int dg[200000];
int main() {
  ios_base::sync_with_stdio(false);
  cout << setprecision(20);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    dg[x]++;
    dg[y]++;
  }
  for (int i = 0; i < n; i++) {
    if (dg[i] == 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
