Galaxy confusion

please explain the 4th and 5th test cases… and

What does this mean “Two planets are connected after the comet arrives if and only if the distance between the planets was equal to 2 before the comet arrives.”?

Which distance are you talking about there is no distance given anywhere…? and

How does they make new connections after broken by comet?

Check out the second line in the first paragraph: “The distance between a pair of planets is the least number of connections that you have to pass through while travelling from the first planet to the second.”.
So, depending on the state of the galaxy at the time when the comet passes, the current connections get broken, and only those planets get connected which were at a distance of ‘2’ before the comet arrived. Hope this cleared your doubt :slight_smile:

oh I missed that thanks…