#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
vector<int> v[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  if (n == 2) {
    cout << "YES" << endl;
    return 0;
  }
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  int count = 0;
  for (int i = 1; i <= n; i++) {
    if (v[i].size() == 2) {
      cout << "NO" << endl;
      return 0;
    }
  }
  long long a = 1;
  cout << "YES" << endl;
  return 0;
}
