#include <bits/stdc++.h>   using namespace std;   vector<long long> v[100001];   int main() {     int n;     cin >> n;     for (long long i = 1; i < n; i++) {       long long a, b;       cin >> a >> b;       v[a].push_back(b);       v[b].push_back(a);     }     for (long long i = 1; i <= n; i++) {       if (v[i].size() == 2) {         cout <<  NO ;         return 0;       }     }     cout <<  YES ;   }   