Check if the Graph is a Butterfly
Given an undirected graph with only 5 vertices and
eedges, you are asked to check if it’s a butterfly.
A butterfly graph is a graph that has five nodes, with one central node and four nodes connected to it. The central node has two nodes connected to it, and those two nodes are connected to each other, on one side. On the other side, it also has two nodes connected to the central one, and those two are connected to each other.
The first line of the input contains a single integer
e(1 ≤ e ≤ 20).
elines contain pairs of integers
v2(1 ≤ v1, v2 ≤ 5) which means that the vertex
v1is connected to the vertex
The program should print
Yesif the graph is a butterfly, and
6 1 4 1 3 3 4 4 2 4 5 2 5
Time limit: 1 seconds
Memory limit: 512 MB
Output limit: 1 MB