def METHOD_NAME(self) -> None:
    union_find = UnionFind()
    union_find.add(1)
    union_find.union(2, 1)
    union_find.union(3, 2)
    count = 0
    for _ in union_find:
        count += 1
    self.assertEqual(count, 3)
    keys = list(union_find)
    self.assertEqual(keys[0], 1)