#include <bits/stdc++.h>
using namespace std;
int vis[100005];
vector<long long> a[100005];
int f = 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    int n;
    cin >> n;
    for (long long i = 0; i < n - 1; i++) {
      long long x, y;
      cin >> x >> y;
      a[x].push_back(y);
      a[y].push_back(x);
    }
    int f = 1;
    for (long long i = 1; i < n + 1; i++) {
      if (a[i].size() == 2) f = 0;
    }
    if (!f)
      cout << "NO";
    else
      cout << "YES";
  }
  return 0;
}
