#include <bits/stdc++.h>
using namespace std;
void PLAY() {
  cout << fixed << setprecision(10);
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long fx4[] = {-1, 1, 0, 0};
long long fy4[] = {0, 0, -1, 1};
long long fx8[] = {-1, -1, -1, 0, 1, 1, 1, 0};
long long fy8[] = {-1, 0, 1, 1, 1, 0, -1, -1};
const long long N = 2e5 + 5;
map<long long, vector<long long>> g;
long long n;
int32_t main() {
  PLAY();
  cin >> n;
  for (long long i = 1; i <= n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  bool k = false;
  for (auto i : g) {
    if (g[i.first].size() == 2) k = true;
  }
  if (k)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
}
