#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 11;
vector<int> v[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int l, r;
    cin >> l >> r;
    v[l].push_back(r);
    v[r].push_back(l);
  }
  for (int i = 1; i <= n; i++)
    if (v[i].size() == 2) {
      cout << "NO";
      return 0;
    }
  cout << "YES";
}
