#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int n;
int D[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    D[x]++, D[y]++;
  }
  for (int i = 1; i <= n; i++) {
    if (D[i] == 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
