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