#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, cnt = 0;
  cin >> n;
  vector<vector<int>> adj(n);
  vector<int> deg(n);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
    deg[x]++, deg[y]++;
  }
  for (int i = 0; i < n; i++)
    if (deg[i] == 1)
      cnt++;
    else if (deg[i] == 2) {
      cnt = 0;
      break;
    }
  if ((long long)cnt * (cnt - 1) >= 2 * (n - 1))
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
  return 0;
}
