#include using namespace std; const int MAXN = 200010; vector adj[MAXN]; int ant[MAXN], degin[MAXN]; priority_queue, vector >, greater > > pq; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; for (int i=1;i>u>>v; adj[u].push_back(v); adj[v].push_back(u); degin[u]++; degin[v]++; } for (int i=1;i<=n;i++) { ant[i]=1; if (degin[i] == 1) { pq.push({ant[i], i}); } } bool sol = true; while (!pq.empty()) { pair vrh = pq.top(); pq.pop(); int node = vrh.second; for (auto x : adj[node]) { if (ant[x] > 0) { //cerr << "PREBACI IZ " << node << " U " << x << endl; degin[x]--; if (ant[x] < ant[node]) { sol = false; break; } ant[x] += ant[node]; ant[node] = 0; if (degin[x] == 1) { pq.push({ant[x], x}); } } } if (sol == false) break; } int cnt = 0; for (int i = 1; i <= n; i++) { if (ant[i] > 0) { cnt++; } } if (cnt > 1) sol = false; if (sol) { cout << "YES"; } else { cout << "NO"; } return 0; }