#include <bits/stdc++.h>
using namespace std;
const long long int MAX = 2e5 + 14;
vector<long long int> Tree[MAX];
vector<bool> seen(MAX);
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long long int n;
  cin >> n;
  for (long long int i = 1; i < n; ++i) {
    long long int u, v;
    cin >> u >> v;
    Tree[u].emplace_back(v);
    Tree[v].emplace_back(u);
  };
  string res = "YES\n";
  for (long long int i = 1; i <= n; ++i) {
    if (Tree[i].size() == 2) {
      res = "NO\n";
      break;
    }
  }
  cout << res;
}
