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 C {

	static int adj[][] = {{0,0},{1,0},{0,1},{1,1}};

	public static void main(String[] args) {
        FastScanner in = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int t = in.nextInt();
        while(t-->0) { 
        	int n = in.nextInt(), m = in.nextInt();
        	char ch[][] = new char[n][m];
        	for(int i=0;i<n;i++) ch[i] = in.next().toCharArray();
        	ArrayList<data> ans = new ArrayList<>();
        	for(int i=0;i<=n-2;i++){
        		for(int j=0;j<=m-2;j++){
        			int oneCnt = 0;
        			for(int k[] : adj){
        				if(ch[i+k[0]][j+k[1]]=='1') oneCnt++;
        			}
        			if(oneCnt==0) continue;
        			if(oneCnt==1||oneCnt==4){
        				int c = 0;
        				if(oneCnt==4){
        					for(int k[] : adj){
        						if(k[0]==k[1]&&k[1]==0) continue;
        						ch[i+k[0]][j+k[1]] = '0';
        					}
        					ans.add(new data(i+1,j,i,j+1,i+1,j+1));
        				}
        				pair one, z1, z2, z3;
        				one = z1 = z2 = z3 = new pair(0,0);
        				for(int k[] : adj){
        					if(ch[i+k[0]][j+k[1]]=='1') one = new pair(i+k[0],j+k[1]);
        					else if(c==0){
        						z1 = new pair(i+k[0],j+k[1]);c++;
        					}
        					else if(c==1){
        						z2 = new pair(i+k[0],j+k[1]);c++;
        					}
        					else z3 = new pair(i+k[0],j+k[1]);
        					ch[i+k[0]][j+k[1]] = '0';
        				}
        				ans.add(new data(one.first(),one.second(),z1.first(),z1.second(),z2.first(),z2.second()));
        				ans.add(new data(one.first(),one.second(),z1.first(),z1.second(),z3.first(),z3.second()));
        				ans.add(new data(one.first(),one.second(),z2.first(),z2.second(),z3.first(),z3.second()));
        			}
        			else if(oneCnt==2){
        				pair o1, o2, z1, z2;
        				o1 = o2 = z1 = z2 = new pair(0,0);
        				int c1 = 0, c0 = 0;
        				for(int k[] : adj){
        					if(ch[i+k[0]][j+k[1]]=='1'){
        						if(c1==0){
        							o1 = new pair(i+k[0],j+k[1]);c1++;
        						}
        						else{
        							o2 = new pair(i+k[0],j+k[1]);
        						}
        					}
        					else if(c0==0){
        						z1 = new pair(i+k[0],j+k[1]);c0++;
        					}
        					else{
        						z2 = new pair(i+k[0],j+k[1]);
        					}
        					ch[i+k[0]][j+k[1]] = '0';
        				}
        				ans.add(new data(o1.first(),o1.second(),z2.first(),z2.second(),z1.first(),z1.second()));
        				ans.add(new data(o2.first(),o2.second(),z2.first(),z2.second(),z1.first(),z1.second()));
        			}
        			else{
        				pair o1, o2, o3;
        				o1 = o2 = o3 = new pair(0,0);
        				int c1 = 0;
        				for(int k[] : adj){
        					if(ch[i+k[0]][j+k[1]]=='1'){
        						if(c1==0){
        							ch[i+k[0]][j+k[1]] = '0';c1++;
        							o1 = new pair(i+k[0],j+k[1]);
        						}
        						else if(c1==1){
        							ch[i+k[0]][j+k[1]] = '0';c1++;
        							o2 = new pair(i+k[0],j+k[1]);
        						}
        						else {
        							o3 = new pair(i+k[0],j+k[1]);
        						}
        					}
        					ch[i+k[0]][j+k[1]] = '0';
        				}
        				ans.add(new data(o1.first(),o1.second(),o2.first(),o2.second(),o3.first(),o3.second()));
        				
        			}
        		}
        	}
        	out.println(ans.size());
        	for(data a : ans){
        		out.println(a.x1()+" "+a.x2()+" "+a.x3()+" "+a.x4()+" "+a.x5()+" "+a.x6());
        	}
        }
        out.flush();
	}

   //out.println((i+k[0])+" "+(j+k[1]));
	static class pair{
		int a,b;
		pair(int x,int y){a=x;b=y;}
		int first() {return a;}
		int second() {return b;}
	}

	static class data{
		int a,b,c,d,e,f;
		data(int q, int w, int ee, int r, int t, int y){
			a=q;b=w;c=ee;d=r;e=t;f=y;
		}
		int x1(){return a+1;}
		int x2(){return b+1;}
		int x3(){return c+1;}
		int x4(){return d+1;}
		int x5(){return e+1;}
		int x6(){return f+1;}
	}
	
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		
		String next() {
			while(!st.hasMoreTokens())
				try { st = new StringTokenizer(br.readLine()); }
				catch(IOException e) {}
			return st.nextToken();
		}
		
		String nextLine(){
			try{ return br.readLine(); } 
			catch(IOException e) { } return "";
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		int[] readArray(int n) {
			int a[] = new int[n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		}
	}

	static final Random random = new Random();

	static void ruffleSort(int[] a){
		int n = a.length;
		for(int i=0;i<n;i++){
			int j = random.nextInt(n), temp = a[j];
			a[j] = a[i]; a[i] = temp;
		}
		Arrays.sort(a);
	}
}