**WRONG**

solutionI used priority queue to keep shortest at top of the graph and print them according to group number, as group number will be the smallest element in the individual graph, and initially each pq contains one element i.e. itself, and group number as itself, if a link with some other vertex is found with smaller group number, its all elements are transferred to that pq, and in case of duplicate , all of them are removed/ as it failed at test case 8 and 22nd th element is different , and other aren’t visible to me and even if were, making a matrices on copy and solving by pen would be tough , can you please help me figure out whats wrong.

**Thanks in advance**

CODEFORCES 500B LINK

CODEFORCES 500B LINK