print out the connected components