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.util.*;

public class Solution{
    static boolean[] prime;
    static int cnt;
    static StringBuilder s;
    static int[] x = new int[]{0,1,0,1};
    static int[] y = new int[]{0,0,1,1};
    public static void main(String[] args){
        try {
            PrintWriter out=new PrintWriter(System.out,true);
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            int t = Integer.parseInt(br.readLine());
            for(int i=0;i<t;i++){

                String[] ss = br.readLine().split(" ");
                int n = Integer.parseInt(ss[0]);
                int m = Integer.parseInt(ss[1]);
                int[][] arr = new int[n][m];
                for(int j=0;j<n;j++){
                    String str = br.readLine();
                    for(int k=0;k<m;k++){
                        if(str.charAt(k)=='0'){
                            arr[j][k]=0;
                        }else{
                            arr[j][k]=1;
                        }
                    }
                }
                cnt=0;
                s = new StringBuilder("");

                for(int j=0;j<n-1;j++){
                    for(int k=0;k<m-1;k++){
                        //out.println(j+" "+k);
                        int c=0;

                        for(int a=0;a<4;a++){
                            if(arr[j+x[a]][k+y[a]]==1){
                                c++;
                            }
                        }
                        if(c==4) {
                            cure4(arr,j,k);
                        }else if(c==3){
                            cure3(arr,j,k);
                        }else if(c==2){
                            cure2(arr,j,k);
                        }else if(c==1){
                            cure1(arr,j,k);
                        }
                    }
                }

                out.println(cnt);
                out.println(s);
            }
            out.close();
        } catch (Exception e) {
            System.out.println("kkkk "+ e.getMessage());
        }
    }
    static void cure3(int[][] arr,int j,int k){
        List<pair> one = new ArrayList<>();
        for(int a=0;a<4;a++){
            if(arr[j+x[a]][k+y[a]]==1){
                one.add(new pair(j+x[a]+1,k+y[a]+1));
            }
        }
        arr[one.get(2).a-1][one.get(2).b-1]=0;
        arr[one.get(1).a-1][one.get(1).b-1]=0;
        arr[one.get(0).a-1][one.get(0).b-1]=0;

        if(cnt>0){
            s.append("\n");
        }
        cnt+=1;
        s.append(one.get(0).a+" "+one.get(0).b+" "+one.get(1).a+" "+one.get(1).b+" "+one.get(2).a+" "+one.get(2).b);
    }
    static void cure2(int[][] arr,int j,int k){
        List<pair> one = new ArrayList<>(), zero =new ArrayList<>();
        for(int a=0;a<4;a++){
            if(arr[j+x[a]][k+y[a]]==1){
                one.add(new pair(j+x[a]+1,k+y[a]+1));
            }else{
                zero.add(new pair(j+x[a]+1,k+y[a]+1));
            }
        }

        if(cnt>0){
            s.append("\n");
        }
        cnt+=1;
        arr[zero.get(0).a-1][zero.get(0).b-1]=1;
        arr[zero.get(1).a-1][zero.get(1).b-1]=1;
        arr[one.get(0).a-1][one.get(0).b-1]=0;
        s.append(zero.get(0).a+" "+zero.get(0).b+" "+zero.get(1).a+" "+zero.get(1).b+" "+one.get(0).a+" "+one.get(0).b);
        cure3(arr,j,k);
    }
    static void cure1(int[][] arr,int j,int k){
        List<pair> one = new ArrayList<>(), zero =new ArrayList<>();
        for(int a=0;a<4;a++){
            if(arr[j+x[a]][k+y[a]]==1){
                one.add(new pair(j+x[a]+1,k+y[a]+1));
            }else{
                zero.add(new pair(j+x[a]+1,k+y[a]+1));
            }
        }
        arr[zero.get(0).a-1][zero.get(0).b-1]=1;
        arr[zero.get(1).a-1][zero.get(1).b-1]=1;
        arr[one.get(0).a-1][one.get(0).b-1]=0;
        if(cnt>0){
            s.append("\n");
        }
        cnt+=1;
        s.append(zero.get(0).a+" "+zero.get(0).b+" "+zero.get(1).a+" "+zero.get(1).b+" "+one.get(0).a+" "+one.get(0).b);
        cure2(arr,j,k);
    }
    static void cure4(int[][] arr,int j,int k){
        if(cnt>0){
            s.append("\n");
        }
        cnt+=1;
        arr[j][k]=0;
        arr[j+1][k]=0;
        arr[j][k+1]=0;

        s.append((j+1)+" "+(k+1)+" "+(j+2)+" "+(k+1)+" "+(j+1)+" "+(k+2));
        cure1(arr,j,k);
    }




    static void sieveOfEratosthenes(int n) {
        prime = new boolean[n+1];
        for(int i=0;i<=n;i++)
            prime[i] = true;
        for(int p = 2; p*p <=n; p++)
        {
            if(prime[p])
            {
                for(int i = p*p; i <= n; i += p)
                    prime[i] = false;
            }
        }
    }




    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    static int lcm(int a,int b){
        long c=a*b;
        return (int)(c/hcf(a,b));
    }
    static int hcf(int a,int b){
        if(a==0){
            return b;
        }
        if(b==0){
            return a;
        }
        if(a>b)
            return hcf(a%b,b);

        return hcf(a,b%a);
    }

    static int modInverse(int x,int m){
        return power(x,m-2,m);
    }
    static int power(int x, int y, int m)
    {
        if (y == 0)
            return 1;

        long p = power(x, y / 2, m) % m;
        p = (p * p) % m;

        return (int)((y%2==0)? p : (x*p)%m);
    }
    static class pair{
        int a,b;
        public pair(int a,int b){
            this.a=a;
            this.b=b;
        }
    }
}