#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using uint = unsigned int;
const int N = 1e5 + 5, MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> deg(n + 1);
  for (int i = 1, u, v; i < n; i++) {
    cin >> u >> v;
    deg[u]++;
    deg[v]++;
  }
  if (find(deg.begin(), deg.end(), 2) == deg.end())
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
