Given a list of matching/equivalent song pairs and a list of unique songs, create unique sets of equivalent songs.
Example 1:
Input:
matching pairs: [[1, 2], [2, 3], [5, 6], [4, 6], [2, 7], [3, 8], [9, 10]]
unique songs: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Output: [[1, 2, 3, 7, 8], [4, 5, 6], [9, 10]]Note that transitivity should be considered.