#include <bits/stdc++.h>
using namespace std;
using lint = long long;
int main() {
  int N;
  cin >> N;
  vector<int> deg(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    deg[a]++;
    deg[b]++;
  }
  cout << (count(deg.begin(), deg.end(), 2) == 0 ? "YES" : "NO") << endl;
  return 0;
}
