



The first line of the input contains an integer ‘T’ representing the number of test cases.
The first line of each test case contains space-separated integers denoting the values of nodes of the Linked List. The Linked List is terminated with -1. Hence, -1 is never a node value of the Linked List.
The second line of each test case contains a single integer ‘K’.
For each test case return space-separated integers denoting the values of nodes of the Linked List.
The output of each test case will be printed in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 5
0 <= N <= 5*10^4
1 <= DATA <= 10^9 and DATA != -1
1 <= K <= 10^9
Time Limit: 1 sec
The idea here is to Make two-pointers and store all nodes that have values less than ‘K’ in one pointer and all nodes that have values greater or equal to ‘K’ in another pointer. Then we will merge these two to get our answer.
Algorithm: