Problem: This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.

You are given a binary table of size n × m. This table consists of symbols 0 and 1.

You can make such operation: select 3 different cells that belong to one 2 × 2 square and change the symbols in these cells (change 0 to 1 and 1 to 0).

Your task is to make all symbols in the table equal to 0. You are allowed to make at most 3nm operations. You don't need to minimize the number of operations.

It can be proved that it is always possible.

Input

The first line contains a single integer t (1 ≤ t ≤ 5000) — the number of test cases. The next lines contain descriptions of test cases.

The first line of the description of each test case contains two integers n, m (2 ≤ n, m ≤ 100).

Each of the next n lines contains a binary string of length m, describing the symbols of the next row of the table.

It is guaranteed that the sum of nm for all test cases does not exceed 20000.

Output

For each test case print the integer k (0 ≤ k ≤ 3nm) — the number of operations.

In the each of the next k lines print 6 integers x_1, y_1, x_2, y_2, x_3, y_3 (1 ≤ x_1, x_2, x_3 ≤ n, 1 ≤ y_1, y_2, y_3 ≤ m) describing the next operation. This operation will be made with three cells (x_1, y_1), (x_2, y_2), (x_3, y_3). These three cells should be different. These three cells should belong into some 2 × 2 square.

Example

Input


5
2 2
10
11
3 3
011
101
110
4 4
1111
0110
0110
1111
5 5
01011
11001
00010
11011
10000
2 3
011
101


Output


1
1 1 2 1 2 2
2 
2 1 3 1 3 2
1 2 1 3 2 3
4
1 1 1 2 2 2 
1 3 1 4 2 3
3 2 4 1 4 2
3 3 4 3 4 4
4
1 2 2 1 2 2 
1 4 1 5 2 5 
4 1 4 2 5 1
4 4 4 5 3 4
2
1 3 2 2 2 3
1 2 2 1 2 2

Note

In the first test case, it is possible to make only one operation with cells (1, 1), (2, 1), (2, 2). After that, all symbols will be equal to 0.

In the second test case:

  * operation with cells (2, 1), (3, 1), (3, 2). After it the table will be: 
    
          
    011  
    001  
    000  
    

  * operation with cells (1, 2), (1, 3), (2, 3). After it the table will be: 
    
          
    000  
    000  
    000  
    




In the fifth test case:

  * operation with cells (1, 3), (2, 2), (2, 3). After it the table will be: 
    
          
    010  
    110  
    

  * operation with cells (1, 2), (2, 1), (2, 2). After it the table will be: 
    
          
    000  
    000  
    

Solution (in JAVA):

Solution:
import java.util.*;
// import java.lang.*;
import java.io.*;

//           THIS TEMPLATE MADE BY AKSH BANSAL.

public class Solution {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    private static boolean[] isPrime;
    private static void primes(){
        int num = (int)1e6; // PRIMES FROM 1 TO NUM
        isPrime = new boolean[num];
     
        for (int i = 2; i< isPrime.length; i++) {
           isPrime[i] = true;
        }
        for (int i = 2; i< Math.sqrt(num); i++) {
           if(isPrime[i] == true) {
              for(int j = (i*i); j<num; j = j+i) {
                 isPrime[j] = false;
              }
           }
        }
    }
    static void sort(int a[]){
        ArrayList<Integer> arr=new ArrayList<>();
        for(int i=0;i<a.length;i++)
        arr.add(a[i]);
        Collections.sort(arr);
        for(int i=0;i<a.length;i++)
        a[i]=arr.get(i);
        
    }
    static void sort(long a[]){
        ArrayList<Long> arr=new ArrayList<>();
        for(int i=0;i<a.length;i++)
        arr.add(a[i]);
        Collections.sort(arr);
        for(int i=0;i<a.length;i++)
        a[i]=arr.get(i);
        
    }
    private static long gcd(long a, long b){
        if(b==0)return a;
        return gcd(b,a%b);
    }
    private static long pow(long x,long y){
        if(y==0)return 1;
        long temp = pow(x, y/2);
        if(y%2==1){
            return x*temp*temp;
        }
        else{
            return temp*temp;
        }
    }
    // static ArrayList<Integer>[] adj;
    // static void getAdj(int n,int q, FastReader sc){
    //     adj = new ArrayList[n+1];
    //     for(int i=1;i<=n;i++){
    //         adj[i] = new ArrayList<>();
    //     }
    //     for(int i=0;i<q;i++){
    //         int a = sc.nextInt();
    //         int b = sc.nextInt();

    //         adj[a].add(b);
    //         adj[b].add(a);
    //     }
    // }
    static PrintWriter out;
    static FastReader sc ;
    public static void main(String[] args) throws IOException {
        sc = new FastReader();
        out = new PrintWriter(System.out);
        // primes();
        // ________________________________

        int t = sc.nextInt();
        StringBuilder output = new StringBuilder();

        while (t-- > 0) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int[][]arr = new int[n][m];
            for(int i=0;i<n;i++){
                String s = sc.nextLine();
                for(int j=0;j<m;j++){
                    arr[i][j] = (int)(s.charAt(j)-'0');
                }
            }
            // output.append().append("\n");
            solver(arr, n, m);
        }

        out.println(output);
        // _______________________________

        // int n = sc.nextInt();
        // out.println(solver());
        // ________________________________
        out.flush();
    }
    static int[][]dir = new int[][]{{0,0}, {0,1}, {1,0}, {1,1}};

    public static void solver(int[][] arr, int n, int m) {
        int res = 0;
        ArrayList<int[]> ans = new ArrayList<>();
        // 3-4
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(i<n-1 && j<m-1){
                    int count = 0;
                    for(int k=0;k<4;k++){
                        if(arr[i+dir[k][0]][j+dir[k][1]]==1){
                            count++;
                        }
                    }
                    if(count==4){
                        res++;
                        ans.add(new int[]{i,j,i+1,j,i,j+1});
                        arr[i][j] = 0;
                        arr[i+1][j] = 0;
                        arr[i][j+1] = 0;
                    }
                    else if(count==3){
                        res++;
                        int pos = 0;
                        int[] temp = new int[6];
                        for(int k=0;k<4;k++){
                            if(arr[i+dir[k][0]][j+dir[k][1]]==1){
                                temp[pos++] = i+dir[k][0];
                                temp[pos++] = j+dir[k][1];

                            }
                        }
                        ans.add(temp);
                        arr[i][j] = 0;
                        arr[i+1][j] = 0;
                        arr[i][j+1] = 0;
                        arr[i+1][j+1] = 0;
                    }
                }
            }
        }

        // 2
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(i<n-1 && j<m-1){
                    int count = 0;
                    int x =-1, y=-1;
                    for(int k=0;k<4;k++){
                        if(arr[i+dir[k][0]][j+dir[k][1]]==1){
                            count++;
                            if(x==-1){
                                x=k;
                            }
                            else{
                                y=k;
                            }
                        }
                    }
                    if(count==2){
                        res+=2;
                        int pos = 2;
                        int[] temp1 = new int[6];
                        int[] temp2 = new int[6];
                        temp1[0] = i+dir[x][0];
                        temp1[1] = j+dir[x][1];
                        temp2[0] = i+dir[y][0];
                        temp2[1] = j+dir[y][1];
                        for(int k=0;k<4;k++){
                            if(k!=x && k!=y){
                                temp1[pos] = i+dir[k][0];
                                temp1[pos+1] = j+dir[k][1];
                                temp2[pos] = i+dir[k][0];
                                temp2[pos+1] = j+dir[k][1];
                                pos+=2;
                            }
                        }
                        ans.add(temp1);
                        ans.add(temp2);
                        arr[i][j] = 0;
                        arr[i+1][j] = 0;
                        arr[i][j+1] = 0;
                        arr[i+1][j+1] = 0;
                    }
                }
            }
        }


        // 1
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(i<n-1 && j<m-1){
                    int[] temp1 = new int[6];
                    int[] temp2 = new int[6];
                    int[] temp3 = new int[6];
                    int x =-1, y=-1;
                    for(int k=0;k<4;k++){
                        if(arr[i+dir[k][0]][j+dir[k][1]]==1){
                            temp1[0] = i+dir[k][0];
                            temp1[1] = j+dir[k][1];
                            if(k==0){
                                temp1[2] = i+dir[1][0];
                                temp1[3] = j+dir[1][1];
                                temp1[4] = i+dir[3][0];
                                temp1[5] = j+dir[3][1];

                                temp2[0] = i+dir[1][0];
                                temp2[1] = j+dir[1][1];
                                temp2[2] = i+dir[0][0];
                                temp2[3] = j+dir[0][1];
                                temp2[4] = i+dir[2][0];
                                temp2[5] = j+dir[2][1];

                                temp3[0] = i+dir[0][0];
                                temp3[1] = j+dir[0][1];
                                temp3[2] = i+dir[2][0];
                                temp3[3] = j+dir[2][1];
                                temp3[4] = i+dir[3][0];
                                temp3[5] = j+dir[3][1];
                            }
                            if(k==1){
                                temp1[2] = i+dir[0][0];
                                temp1[3] = j+dir[0][1];
                                temp1[4] = i+dir[2][0];
                                temp1[5] = j+dir[2][1];

                                temp2[0] = i+dir[1][0];
                                temp2[1] = j+dir[1][1];
                                temp2[2] = i+dir[0][0];
                                temp2[3] = j+dir[0][1];
                                temp2[4] = i+dir[3][0];
                                temp2[5] = j+dir[3][1];

                                temp3[0] = i+dir[1][0];
                                temp3[1] = j+dir[1][1];
                                temp3[2] = i+dir[2][0];
                                temp3[3] = j+dir[2][1];
                                temp3[4] = i+dir[3][0];
                                temp3[5] = j+dir[3][1];
                            }
                            if(k==2){
                                temp1[2] = i+dir[0][0];
                                temp1[3] = j+dir[0][1];
                                temp1[4] = i+dir[1][0];
                                temp1[5] = j+dir[1][1];

                                temp2[0] = i+dir[1][0];
                                temp2[1] = j+dir[1][1];
                                temp2[2] = i+dir[3][0];
                                temp2[3] = j+dir[3][1];
                                temp2[4] = i+dir[2][0];
                                temp2[5] = j+dir[2][1];

                                temp3[0] = i+dir[0][0];
                                temp3[1] = j+dir[0][1];
                                temp3[2] = i+dir[2][0];
                                temp3[3] = j+dir[2][1];
                                temp3[4] = i+dir[3][0];
                                temp3[5] = j+dir[3][1];
                            }
                            if(k==3){
                                temp1[2] = i+dir[0][0];
                                temp1[3] = j+dir[0][1];
                                temp1[4] = i+dir[1][0];
                                temp1[5] = j+dir[1][1];

                                temp2[0] = i+dir[1][0];
                                temp2[1] = j+dir[1][1];
                                temp2[2] = i+dir[3][0];
                                temp2[3] = j+dir[3][1];
                                temp2[4] = i+dir[2][0];
                                temp2[5] = j+dir[2][1];

                                temp3[0] = i+dir[0][0];
                                temp3[1] = j+dir[0][1];
                                temp3[2] = i+dir[2][0];
                                temp3[3] = j+dir[2][1];
                                temp3[4] = i+dir[3][0];
                                temp3[5] = j+dir[3][1];
                            }
                            ans.add(temp1);
                            ans.add(temp2);
                            ans.add(temp3);
                            arr[i][j] = 0;
                            arr[i+1][j] = 0;
                            arr[i][j+1] = 0;
                            arr[i+1][j+1] = 0;
                            break;
                        }

                    }

                }
            }
        }

        out.println(ans.size());
        for(int i=0;i<ans.size();i++){
            for(int j=0;j<6;j++){
                out.print((ans.get(i)[j]+1)+" ");
            }
            out.println();
        }

    }
}