


The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of each test case contains 'N'(number of nodes in the linked list) space-separated integers representing the value of each node. -1 at the end denotes NULL pointer.
For example :
The input 0 1 2 -1 denotes a linked list containing 3 nodes represented as:

For each test case, in a separate line, print the final sorted linked list.
You don’t have to print anything; it has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= N <= 100000
0 <= data <= 2
where ‘T’ is the total number of test cases, 'N' is the total number of nodes in the linked list and ‘data’ is the value of any node of the linked list.
The idea is to count the number of zero’s, one’s and two’s and then iterate through the list again from beginning to end and put zero’s, then one’s and then two’s.
The idea is to traverse the linked list and maintain three pointers, say zeroPointer, onePointer and twoPointer for each of the values in the linked list that are zeros, one’s and two's. Basically we will just change the links of zeros, one’s and two's.