Let me walk through a sample input step by step. You will see how components are identified, how representatives are chosen, and which edges are output. I'll trace through the Union-Find operations and show the final component list.
Watch how the chain of edges connects all components. This walkthrough clarifies the component-chaining strategy. The algorithm is simpler than it sounds once you see it in action.