Problem6279--ABC225 —— B - Star or Not

6279: ABC225 —— B - Star or Not

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

You are given a tree with $N$ vertices and $N-1$ edges.
The vertices are numbered $1,2,\ldots,N$. The $i$-th edge connects Vertex $a_i$ and Vertex $b_i$.
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.

Input

Input is given from Standard Input in the following format:
$N$
$a_1\ b_1$
$\vdots$
$a_{N-1}\ b_{N-1}$

Output

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

Constraints

$3≤N≤10^5$
$1 \leq a_i \lt b_i \leq N$
The given graph is a tree.

Sample 1 Input

5
1 4
2 4
3 4
4 5

Sample 1 Output

Yes
The given graph is a star.

Sample 2 Input

4
2 4
1 4
2 3

Sample 2 Output

No
The given graph is not a star.

Sample 3 Input

10
9 10
3 10
4 10
8 10
1 10
2 10
7 10
6 10
5 10

Sample 3 Output

Yes

Source/Category