compare_lists_elements(a, b) that returns a tuple (common, only_in_a, only_in_b). common holds values present in both lists (no duplicates, any order), only_in_a holds values present in a but not b, and only_in_b the reverse. Return each as a sorted list for a deterministic result.a = [1, 2, 3, 4], b = [3, 4, 5]
([3, 4], [1, 2], [5])
3 and 4 appear in both; 1, 2 only in a; 5 only in b.
Converting both lists to sets makes intersection/difference easy, then sort the results back into lists.