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

public class Solution
{
    static class Reader {
		BufferedReader br;
		StringTokenizer st;
 
		public Reader() {
			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;
		}
 
	}
    static class Ele implements Comparable<Ele> 
    {  
        public int x,x1,y,y1,z,z1;  
        Ele(int x,int x1,int y,int y1, int z,int z1) 
        {  
            this.x=x;this.x1=x1;this.y=y;this.y1=y1;this.z=z;this.z1=z1; 
        }  
        public int compareTo(Ele ob) {  
        if(ob.x!=x)return x-ob.x;
        return this.y-ob.y;  
        }   
    }
    int a[][];int b[][];
    
    long gcd(long a,long b)
    {
        long min=Math.min(a,b);
        long max=Math.max(a,b);
        while (max%min!=0)
        {
            a=max%min;
            max=min;min=a;
        }
        return min;
    }
	public static void main(String[] args) throws IOException 
	{
		Reader sc=new Reader();Solution G=new Solution();
		PrintWriter o = new PrintWriter(System.out);
		int t=1;t=sc.nextInt();
		int x,x0,x1,x2;int y,y0,y1,y2;int s,s0,s1,s2;
		int n,m;int a[][],b[],in[],in1[];
		long k,l;boolean b1,b2;String ss1[],ss;
		//long l;long a[]; 
		ArrayList<ArrayList<Integer>> ll=new ArrayList<>();
		ArrayList<Ele> a1=new ArrayList<>();
		ArrayList<Integer> a2=new ArrayList<>();
		ArrayList<Integer> a3=new ArrayList<>();
		ArrayDeque<Integer> deq=new ArrayDeque<>();
		TreeSet<Integer> h0=new TreeSet<>();
		TreeSet<Integer> h1=new TreeSet<>();
		HashMap<Integer,Integer> h=new HashMap<>();
		try{
		while (t-->0)
		{
		    n=sc.nextInt();m=sc.nextInt();a=new int[n][m];
		    for (int i=0;i<n;i++)
		    {
		        char c[]=sc.next().toCharArray();
		        for (int j=0;j<m;j++)
		        a[i][j]=c[j]-'0';
		    }
		    int n1=n-n%2;int m1=m-m%2;
		    
		    for (int i=0;i<n;i+=2)
		    {
		        for (int j=0;j<m;j+=2)
		        {
		            if (i+2>=n)i=n-2;
		            if (j+2>=m)j=m-2;
		            x=a[i][j]+a[i][j+1]+a[i+1][j+1]+a[i+1][j];
		            if (x==4)
		            {
		                a1.add(new Ele(i+1,j+1,i+2,j+2,i+1,j+2));
		                a1.add(new Ele(i+1,j+2,i+2,j+1,i+2,j+2));
		                a1.add(new Ele(i+1,j+1,i+2,j+1,i+2,j+2));
		                a1.add(new Ele(i+1,j+1,i+2,j+1,i+1,j+2));
		            }
		            if (x==3)
		            {
		                if (a[i][j]==0)
		                {
		                    a1.add(new Ele(i+1,j+2,i+2,j+1,i+2,j+2));
		                }
		                else if (a[i][j+1]==0)
		                {
		                    a1.add(new Ele(i+1,j+1,i+2,j+1,i+2,j+2));
		                }
		                else if (a[i+1][j]==0)
		                {
		                    a1.add(new Ele(i+1,j+2,i+1,j+1,i+2,j+2));
		                }
		                else if (a[i+1][j+1]==0)
		                {
		                    a1.add(new Ele(i+1,j+2,i+2,j+1,i+1,j+1));
		                }
		            }
		            else if (x==2)
		            {
		                if (a[i][j]==1 && a[i+1][j+1]==1)
		                {
		                    a1.add(new Ele(i+1,j+1,i+1,j+2,i+2,j+1));
		                    a1.add(new Ele(i+1,j+2,i+2,j+1,i+2,j+2));
		                }
		                else if (a[i][j]==1 && a[i][j+1]==1)
		                {
		                    a1.add(new Ele(i+1,j+1,i+2,j+2,i+2,j+1));
		                    a1.add(new Ele(i+1,j+2,i+2,j+2,i+2,j+1));
		                }
		                else if (a[i][j]==1 && a[i+1][j]==1)
		                {
		                    a1.add(new Ele(i+1,j+1,i+2,j+2,i+1,j+2));
		                    a1.add(new Ele(i+2,j+2,i+1,j+2,i+2,j+1));
		                }
		                
		                else if (a[i][j+1]==1 && a[i+1][j+1]==1)
		                {
		                    a1.add(new Ele(i+1,j+1,i+2,j+1,i+1,j+2));
		                    a1.add(new Ele(i+2,j+1,i+1,j+1,i+2,j+2));
		                }
		                else if (a[i][j+1]==1 && a[i+1][j]==1)
		                {
		                    a1.add(new Ele(i+1,j+1,i+2,j+2,i+1,j+2));
		                    a1.add(new Ele(i+1,j+1,i+2,j+2,i+2,j+1));
		                }
		                
		                
		                
		                
		                else if (a[i+1][j]==1 && a[i+1][j+1]==1)
		                {
		                    a1.add(new Ele(i+1,j+1,i+1,j+2,i+2,j+2));
		                    a1.add(new Ele(i+1,j+1,i+1,j+2,i+2,j+1));
		                }
		                
		                
		                
		                
		            }
		            else if (x==1)
		            {
		                if (a[i][j]==1)
		                {
		                    a1.add(new Ele(i+1,j+1,i+2,j+1,i+2,j+2));
		                    a1.add(new Ele(i+1,j+1,i+1,j+2,i+2,j+2));
		                    a1.add(new Ele(i+1,j+1,i+1,j+2,i+2,j+1));
		                }
		                else if (a[i][j+1]==1)
		                {
		                    a1.add(new Ele(i+1,j+1,i+2,j+1,i+1,j+2));
		                    a1.add(new Ele(i+1,j+1,i+1,j+2,i+2,j+2));
		                    a1.add(new Ele(i+2,j+2,i+1,j+2,i+2,j+1));
		                }
		                else if (a[i+1][j]==1)
		                {
		                    a1.add(new Ele(i+1,j+1,i+2,j+1,i+1,j+2));
		                    a1.add(new Ele(i+1,j+1,i+2,j+1,i+2,j+2));
		                    a1.add(new Ele(i+2,j+1,i+1,j+2,i+2,j+2));
		                }
		                else if (a[i+1][j+1]==1)
		                {
		                    a1.add(new Ele(i+1,j+1,i+2,j+1,i+2,j+2));
		                    a1.add(new Ele(i+1,j+1,i+1,j+2,i+2,j+2));
		                    a1.add(new Ele(i+2,j+2,i+1,j+2,i+2,j+1));
		                }
		            }
		            a[i+1][j+1]=0;a[i][j+1]=0;a[i+1][j]=0;a[i][j]=0;
		        }
		    }
		    
		    
		    
		    
		    
		    
		    
		    
		    o.println(a1.size());
		    for (Ele i:a1)
		    {
		        o.println(i.x+" "+i.x1+" "+i.y+" "+i.y1+" "+i.z+" "+i.z1+" ");
		    }
		    //o.println(l);
		    //o.println();
		    //o.println(h);
		    //o.println(x2);
		    //o.println();
		    h0.clear();ll.clear();a1.clear();a2.clear();h1.clear();
		}
		}
		catch (Throwable e)
		{
		    e.printStackTrace();
		}
		//o.println("HI");
		
        o.flush();
        o.close();
	}
}