Implement the solution from scratch. Use Union-Find to find components. Connect representatives with a chain of edges. Test the solution on the sample inputs. Make sure it handles already-connected graphs (output ). Also test completely disconnected graphs where every node is its own component.
If you get stuck, review the algorithm from the previous units. The implementation is simpler than the MST problems because you do not need to track weights.