#include <bits/stdc++.h>
using namespace std;
const long long BINF = 9e18, LINF = 2e9, mod = 998244353, P = 179,
                Q = 1791791791;
const long long MAXN = 1e6;
vector<long long> g[MAXN];
bool cmp(vector<long long> &a, vector<long long> &b) {
  return a.size() < b.size();
}
void solve() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n - 1; ++i) {
    long long a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  long long root = max_element(g, g + n, cmp) - g;
  for (long long i = 0; i < n; ++i) {
    if (g[i].size() == 2) {
      cout << "NO";
      return;
    }
  }
  cout << "YES";
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cout.precision(40);
  solve();
  return 0;
}
