Beautiful Vertices

Wrong answer in the test cases…please can you help to find the mistake in the code.

@Anshit The edges are bidirectional here, so just correct it this will pass.

Also remember to mark the doubt as resolved if you are able to solve it now.