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.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.LinkedBlockingDeque;


public class scratch_25 {
    // int count=0;
    //static long count=0;
    static 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 double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

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





    static class Pair implements Comparable<Pair>{
        long x;
        long y;
        public Pair(long x,long y){
            this.x=x;
            this.y=y;
        }
        @Override
        public int compareTo(Pair o){
            return (int)this.y-(int)o.y;


        }
        @Override
        public boolean equals(Object me) {
            Pair binMe = (Pair)me;
            if(this.x==binMe.x && this.y==binMe.y)
                return true;
            else
                return false;
        }

        @Override
        public int hashCode() {
            return (int)this.x + (int)this.y;
        }

        @Override
        public String toString() {
            return x+" "+y;
        }


    }





    static int moves=0;
    //static char arr[][];
    public static void main(String[] args)  throws IOException {
        Reader.init(System.in);
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
      int t= Reader.nextInt();
        for (int tt = 0; tt <t ; tt++) {
            StringBuilder str= new StringBuilder();
          int n= Reader.nextInt();
          int m= Reader.nextInt();
            char arr[][]= new char[n][m];
            for (int i = 0; i <n ; i++) {
                arr[i]= Reader.next().toCharArray();
            }
//            for (int k = 0; k <n ; k++) {
//                System.out.println(Arrays.toString(arr[k]));
//            }
            for (int i = 0; i <n-1 ; i++) {
                for (int j = 0; j <m-1 ; j++) {

                    String s= fxn(i+1,j+1,i+1,j+1+1,i+1+1,j+1,i+1+1,j+1+1,arr);
                   // System.out.print(moves);
//                    for (int k = 0; k <n ; k++) {
//                        System.out.println(Arrays.toString(arr[k]));
//                    }
                   // System.out.println("------------");
                    str.append(s);
                }
            }
            out.append(moves+"\n");
            out.append(str);
            moves=0;
//            for (int i = 0; i <n ; i++) {
//                System.out.println(Arrays.toString(arr[i]));
//            }

        }
        out.flush();
        out.close();


    }

    public static String fxn(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4,char arr[][]){
        String s="";
        char c1=arr[x1-1][y1-1];
        char c2= arr[x2-1][y2-1];
        char c3= arr[x3-1][y3-1];
        char c4=arr[x4-1][y4-1];
        arr[x1-1][y1-1]='0';
        arr[x2-1][y2-1]='0';
        arr[x3-1][y3-1]='0';
        arr[x4-1][y4-1]='0';

        int tempx1=x1;
        int tempy1=y1;
        int tempx2=x2;
        int tempy2=y2;
        int tempx3=x3;
        int tempy3=y3;
        int tempx4=x4;
        int tempy4=y4;

        //16 possibilities

        if(c1=='0' && c2=='0'&& c3=='0' && c4=='0'){

        }
        if(c1=='0' && c2=='0' && c3=='0' && c4=='1'){
            moves+=3;
            s+=x1+" "+y1+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x4+" "+y4+"\n";
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
        }
        if(c1=='0' && c2=='0' && c3=='1' && c4=='0'){
            moves+=3;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
//            x1=tempx2;
//            y1=tempy2;
//            x2=tempx1;
//            y2=tempy1;
//            x3=tempx4;
//            y3=tempy4;
//            x4=tempx3;
//            y4=tempy3;
            s+=x1+" "+y1+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x3+" "+y3+"\n";
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
        }
        if(c1=='0' && c2=='1' && c3=='0' && c4=='0'){
            moves+=3;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
//            x1=tempx4;
//            y1=tempy4;
//            x2=tempx3;
//            y2=tempy3;
//            x3=tempx2;
//            y3=tempy2;
//            x4=tempx1;
//            y4=tempy1;
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x4+" "+y4+"\n";
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x3+" "+y3+"\n";
            s+=x2+" "+y2+" "+x4+" "+y4+" "+x3+" "+y3+"\n";
        }
        if(c1=='1' && c2=='0' && c3=='0' && c4=='0'){
            moves+=3;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
////            arr[x4][y4]=0;
//            x1=tempx3;
//            y1=tempy3;
//            x2=tempx4;
//            y2=tempy4;
//            x3=tempx1;
//            y3=tempy1;
//            x4=tempx2;
//            y4=tempy2;
            s+=x1+" "+y1+" "+x3+" "+y3+" "+x4+" "+y4+"\n ";
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x1+" "+y1+"\n";
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x4+" "+y4+"\n";
        }
        if(c1=='0' && c2=='1' && c3=='1' && c4=='1'){
            moves+=1;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
        }
        if(c1=='1' && c2=='0' && c3=='1' && c4=='1'){
            moves+=1;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;

            x1=tempx2;
            y1=tempy2;
            x2=tempx1;
            y2=tempy1;
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";

        }
        if(c1=='1' && c2=='1' && c3=='0' && c4=='1'){
            moves+=1;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
            x1=tempx3;
            y1=tempy3;
            x3=tempx1;
            y3=tempy1;
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";


        }
        if(c1=='1' && c2=='1' && c3=='1' && c4=='0'){
            moves+=1;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
            x1=tempx4;
            y1=tempy4;
            x4=tempx1;
            y4=tempy1;
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
        }

        if(c1=='0' && c2=='1' && c3=='0' && c4=='1'){
            moves+=2;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x3+" "+y3+"\n";
            s+=x1+" "+y1+" "+x3+" "+y3+" "+x4+" "+y4+"\n";

        }
        if(c1=='1' && c2=='0' && c3=='1' && c4=='0'){
            moves+=2;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
            x1=tempx2;
            y1=tempy2;
            x2=tempx1;
            y2=tempy1;
            x3=tempx4;
            y3=tempy4;
            x4=tempx3;
            y4=tempy3;
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x3+" "+y3+"\n";
            s+=x1+" "+y1+" "+x3+" "+y3+" "+x4+" "+y4+"\n";

        }
        if(c1=='1' && c2=='1' && c3=='0' && c4=='0'){
            moves+=2;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
            s+=x1+" "+y1+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
        }
        if(c1=='0' && c2=='0' && c3=='1' && c4=='1'){
            moves+=2;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
            x1=tempx3;
            y1=tempy3;
            x2=tempx4;
            y2=tempy4;
            x3=tempx1;
            y3=tempy1;
            x4=tempx2;
            y4=tempy2;
            s+=x1+" "+y1+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
        }
        if(c1=='1' && c2=='0' && c3=='0' && c4=='1'){
            moves+=2;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x3+" "+y3+"\n";
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
        }
        if(c1=='0' && c2=='1' && c3=='1' && c4=='0'){
            moves+=2;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
            x1=tempx2;
            y1=tempy2;
            x2=tempx1;
            y2=tempy1;
            x3=tempx4;
            y3=tempy4;
            x4=tempx3;
            y4=tempy3;
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x3+" "+y3+"\n";
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
        }
        if(c1=='1' && c2=='1' && c3=='1' && c4=='1'){
            moves+=4;
//            arr[x1][y1]=0;
//            arr[x2][y2]=0;
//            arr[x3][y3]=0;
//            arr[x4][y4]=0;
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x3+" "+y3+"\n";
            s+=x2+" "+y2+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
            s+=x1+" "+y1+" "+x3+" "+y3+" "+x4+" "+y4+"\n";
            s+=x1+" "+y1+" "+x2+" "+y2+" "+x4+" "+y4+"\n";






        }































return s;
    }

























    public static ArrayList<Integer> Sieve(int n) {
        boolean arr[]= new boolean [n+1];
        Arrays.fill(arr,true);
        arr[0]=false;
        arr[1]=false;
        for (int i = 2; i*i <=n ; i++) {
            if(arr[i]){
                for (int j = 2; j <=n/i ; j++) {
                    int u= i*j;
                    arr[u]=false;
                }}
        }
        ArrayList<Integer> ans= new ArrayList<>();
        for (int i = 0; i <n+1 ; i++) {
            if(arr[i]){
                ans.add(i);
            }
        }
        return ans;
    }




    static long power( long x, long y, long p)
    {

        long res = 1;


        x = x % p;

        if (x == 0) return 0;

        while (y > 0)
        {

            if((y & 1)==1)
                res = (res * x) % p;


            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }

    public static long ceil_div(long a, long b){
        return (a+b-1)/b;
    }

    static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }

    static long lcm(long a, long b)
    {
        return (a*b)/gcd(a, b);
    }

}