Problem2267-- Star or Not

2267: Star or Not

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

Time Limit: 2 sec / Memory Limit: 1024 MB

Score : 200200 points

Problem Statement

You are given a tree with NN vertices and N-1N1 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.

Notes

For the definition of a tree, see Tree (graph theory) - Wikipedia.

Constraints

  • 3 \leq N \leq 10^53N105
  • 1 \leq a_i \lt b_i \leq N1ai<biN
  • The given graph is a tree.

Input

Input is given from Standard Input in the following format:
NNa_1a1b_1b1\vdotsa_{N-1}aN1b_{N-1}bN1

Output

If the given graph is a star, print Yes; otherwise, print No.

Sample Input Copy

5
1 4
2 4
3 4
4 5

Sample Output Copy

Yes

HINT

The given graph is a star.

Source/Category