Polycarp has n different binary words. A word called binary if it contains only characters '0' and '1'. For example, these words are binary: "0001", "11", "0" and "0011100".

Polycarp wants to offer his set of n binary words to play a game "words". In this game, players name words and each next word (starting from the second) must start with the last character of the previous word. The first word can be any. For example, these sequence of words can be named during the game: "0101", "1", "10", "00", "00001".

Word reversal is the operation of reversing the order of the characters. For example, the word "0111" after the reversal becomes "1110", the word "11010" after the reversal becomes "01011".

Probably, Polycarp has such a set of words that there is no way to put them in the order correspondent to the game rules. In this situation, he wants to reverse some words from his set so that:

  * the final set of n words still contains different words (i.e. all words are unique); 
  * there is a way to put all words of the final set of words in the order so that the final sequence of n words is consistent with the game rules. 



Polycarp wants to reverse minimal number of words. Please, help him.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 10^4) — the number of test cases in the input. Then t test cases follow.

The first line of a test case contains one integer n (1 ≤ n ≤ 2⋅10^5) — the number of words in the Polycarp's set. Next n lines contain these words. All of n words aren't empty and contains only characters '0' and '1'. The sum of word lengths doesn't exceed 4⋅10^6. All words are different.

Guaranteed, that the sum of n for all test cases in the input doesn't exceed 2⋅10^5. Also, guaranteed that the sum of word lengths for all test cases in the input doesn't exceed 4⋅10^6.

Output

Print answer for all of t test cases in the order they appear.

If there is no answer for the test case, print -1. Otherwise, the first line of the output should contain k (0 ≤ k ≤ n) — the minimal number of words in the set which should be reversed. The second line of the output should contain k distinct integers — the indexes of the words in the set which should be reversed. Words are numerated from 1 to n in the order they appear. If k=0 you can skip this line (or you can print an empty line). If there are many answers you can print any of them.

Example

Input


4
4
0001
1000
0011
0111
3
010
101
0
2
00000
00001
4
01
001
0001
00001


Output


1
3 
-1
0

2
1 2 
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.IllegalCharsetNameException;
import java.sql.SQLOutput;
import java.util.*;



public class Main {
    static int[] arr;
    static boolean[] v;
    static long[] ans;
    static int n;
    static int[] parity;

    public static void main(String[] args) throws IOException{
        Reader.init(System.in);
        int q = Reader.nextInt();
        while (q-->0){
            solve();
        }

    }

    static long fun(int pp , int i  , int hops){
        if (i<0 || i >= n){
            return Long.MAX_VALUE;
        }
        if (v[i]==true){
            if ((pp ^ parity[i])==1){
                return hops;
            }
            else{
                if (ans[i]==Long.MAX_VALUE) {
                    return Long.MAX_VALUE;
                }
                else{
                    return ans[i] + 1;
                }
            }
        }
        if ((pp ^ parity[i])==1){
            return 1;
        }
        v[i] = true;
        long num1 = fun(parity[i] , i + arr[i] , 1);
        long num2 = fun(parity[i] , i - arr[i] , 1);
        ans[i] = Math.min(num1,num2);
        if (ans[i]==Long.MAX_VALUE){
            return ans[i];
        }
        else{
            return ans[i] + 1;
        }

    }







    /*static int find(int x) {
        return parent[x] == x ? x : (parent[x] = find(parent[x]));
    }
    static void merge(int x, int y) {
        x = find(x);
        y = find(y);
        if ( x > y ){
            parent[y] = x;
        }
        else if (y > x){
            parent[x] = y;
        }
    }*/

    static void solve()throws IOException{
        int n = Reader.nextInt();
        TreeSet<String> set = new TreeSet<>();
        Deque<String> q = new LinkedList<>();
        Deque<String> onezero = new LinkedList<>();
        Deque<String> zeroone = new LinkedList<>();
        Deque<Integer> index = new LinkedList<>();
        int cnt1 = 0;
        int cnt2 = 0;
        int cnt3 = 0;
        int cnt4 = 0;
        for (int i = 0 ; i < n ; i++){
            String s = Reader.next();
            if (s.charAt(0)=='0' && s.charAt(s.length() - 1)=='1'){
                set.add(s);
                q.addLast(s);
                index.addLast(i);
                cnt1++;
            }
            else if (s.charAt(0)=='1' && s.charAt(s.length()-1)=='0'){
                set.add(s);
                q.addLast(s);
                cnt2++;
                index.addLast(i);
            }
            else if (s.charAt(0)=='1' && s.charAt(s.length()-1)=='1'){
                cnt3++;
            }
            else if (s.charAt(0)=='0' && s.charAt(s.length()-1)=='0'){
                cnt4++;
            }
        }
        if (cnt1==0 && cnt2==0){
            if (cnt3==0){
                System.out.println(0);
                return;
            }
            else if (cnt4==0){
                System.out.println(0);
                return;
            }
            else{
                System.out.println(-1);
                return;
            }
        }
        int dif = Math.abs(cnt1 - cnt2);
        int f = 0;
        if (cnt1 > cnt2) f = 0;
        else f = 1;
        int r = 0;
        dif--;
        //System.out.println(dif);
        //System.out.println(f);
        Deque<Integer> ans = new LinkedList<>();
        while ((!q.isEmpty()) && dif > 0){
            int idx = index.removeFirst();
            String s = q.removeFirst();
            //System.out.println(s);
            if (f==0) {
                if (s.charAt(0) == '0' && s.charAt(s.length() - 1) == '1') {
                    //System.out.println(s);
                    StringBuilder ss = new StringBuilder(s);
                    ss = ss.reverse();
                    String rev = new String(ss);
                    //System.out.println(rev);
                    if (!set.contains(rev)){
                        r++;
                        ans.addLast(idx+1);
                        dif-=2;
                    }
                }
            }
            else{
                if (s.charAt(0) == '1' && s.charAt(s.length() - 1) == '0') {
                    StringBuilder ss = new StringBuilder(s);
                    ss = ss.reverse();
                    String rev = new String(ss);
                    if (!set.contains(rev)){
                        r++;
                        ans.addLast(idx+1);
                        dif-=2;
                    }
                }

            }
        }
        System.out.println(r);
        while (ans.isEmpty()==false){
            System.out.print(ans.removeFirst() + " ");
        }
        System.out.println();




    }


    public static void sortbyColumn(int arr[][], int col)
    {
        // Using built-in sort function Arrays.sort
        Arrays.sort(arr, new Comparator<int[]>() {

            @Override
            // Compare values according to columns
            public int compare(final int[] entry1,
                               final int[] entry2) {

                // To sort in descending order revert
                // the '>' Operator
                if (entry1[col] > entry2[col])
                    return 1;
                else
                    return -1;
            }
        });  // End of function call sort().
    }


    static class Node{
        long a;
        int i;
        Node(long a, int i){
            this.a = a;
            this.i = i;
        }
    }

}


class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}
class MergeSort
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];


        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

    /* A utility function to print array of size n */
    static void printArray(int arr[])
    {
        int n = arr.length;
        for (int i=0; i<n; ++i)
            System.out.print(arr[i] + " ");
        System.out.println();
    }

    // Driver method

}

class Node implements Comparable<Node>{
    int a;
    int b;
    Node (int a , int b){
        this.a = a;
        this.b = b;
    }



    public int compareTo(Node o) {
        if ((this.a%2) == (o.a%2)){
            return (this.b - o.b);
        }
        else{
            return this.a - o.a;
        }
    }
}