Given a sorted linked list, remove all elements that have duplicates in the Linked List.
After the operation, only those elements should be there which were unique in the original list. Do not change the order of the linked list.
Linked List: 1→2→2→2→3→3→4→7
After removing duplicates: 1→4→7
The first line contains ‘T’ denoting the number of independent test cases.
For each test case the input has two lines:
For each test case, the output has one line with space-separated integers denoting the elements of the resultant linked list.
2
8
1 2 2 2 3 3 4 7
3
4 5 6
1 4 7
4 5 6
1 <= T <= 100
0 <= n <= 104
1 <= element <= 104