Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 200200 points
Problem Statement
You are given a tree with NN vertices and N-1N−1 edges.
The vertices are numbered 1,2,\ldots,N1,2,…,N. The ii-th edge connects Vertex a_iai and Vertex b_ibi.
Determine whether this tree is a star.
Here, a star is a tree where there is a vertex directly connected to all other vertices.
Constraints
-
3 \leq N \leq 10^53≤N≤105
-
1 \leq a_i \lt b_i \leq N1≤ai<bi≤N
-
The given graph is a tree.
Input
Input is given from Standard Input in the following format:
NNa_1a1b_1b1\vdots⋮a_{N-1}aN−1b_{N-1}bN−1
Output
If the given graph is a star, print Yes; otherwise, print No.