Ex. File Transfer

Interface

You shoud implement it with Union by rank and Path compression.

class DSU(number)
__init__(number) None

Initialize an empty DSU.

find(item: int) int

Find the set name (root) of the item.

union(item_x: int, item_y: int) None

Union of two sets.