#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v1(n, 0);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x -= 1;
    y -= 1;
    v1[x] += 1;
    v1[y] += 1;
  }
  int f = 1;
  for (int i = 0; i < n; i++) {
    if (v1[i] == 2) {
      f = 0;
      break;
    }
  }
  if (f == 0)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
}
