Soln works but fails to connect all cities in some test cases.