#include <bits/stdc++.h>
using namespace std;
template <class mytype>
mytype power(mytype a, mytype b, mytype m) {
  if (b == 1) return a % m;
  if (b == 0) return 1;
  mytype root = power<long long int>(a, b / 2, m);
  mytype ans = (root * root) % m;
  if (b % 2) ans = (ans * a) % m;
  return ans;
}
template <class type>
type gcd(type a, type b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
template <class type>
type mod_inv(type a, type p) {
  return power(a, p - 2, p);
}
const long long int MOD = 1e9 + 7;
int c;
int main() {
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    v[x - 1]++;
    v[y - 1]++;
  }
  for (int i = 0; i < n; i++) {
    if (v[i] == 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
