Accounts Merge

Given accounts where each account starts with a person's name followed by one or more email addresses, merge accounts that share at least one email address. Accounts connected through a chain of shared emails belong to the same person. Return one account for each connected component, with the name first and all component emails sorted lexicographically. The order of the returned accounts does not matter.

Examples
Input: [["N0","n00@x.com"],["N0","n00@x.com","n0extra@x.com"]]
Output: [["N0","n00@x.com","n0extra@x.com"]]
Hints

Accounts Merge

Given accounts where each account starts with a person's name followed by one or more email addresses, merge accounts that share at least one email address. Accounts connected through a chain of shared emails belong to the same person. Return one account for each connected component, with the name first and all component emails sorted lexicographically. The order of the returned accounts does not matter.