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:
// Utilities
import java.io.*;
import java.util.*;

public class Main {
	static int T;
	static int N, M;
	static char[][] grid;
	static Queue<Triple> res;
	static int x1, y1, x2, y2, x3, y3;
	static int[] tx, ty;
	static int[] ax, ay;
	static int oneCnt;
	
	public static void main(String[] args) throws IOException {
		T = in.iscan();
		while (T-- > 0) {
			N = in.iscan(); M = in.iscan(); grid = new char[N][M];
			for (int i = 0; i < N; i++) {
				grid[i] = in.sscan().toCharArray();
			}
			res = new LinkedList<Triple>();
			for (int i = 1; i < N; i++) {
				for (int j = 1; j < M; j++) {
					tx = new int[4]; ty = new int[4];
					tx[0] = i-1; ty[0] = j-1;
					tx[1] = i-1; ty[1] = j;
					tx[2] = i; ty[2] = j-1;
					tx[3] = i; ty[3] = j;
					oneCnt = 0;
					for (int k = 0; k < 4; k++) {
						if (grid[tx[k]][ty[k]] == '1') oneCnt++;
					}
					if (oneCnt == 1) {
						attack1();
						attack2();
						attack3();
					}
					else if (oneCnt == 2) {
						attack2(); 
						attack3();
					}
					else if (oneCnt == 3) {
						attack3();
					}
					else if (oneCnt == 4) {
						attack3();
						attack1();
						attack2();
						attack3();
					}
				}
			}
			out.println(res.size());
			while (!res.isEmpty()) {
				x1 = res.peek().x1+1; y1 = res.peek().y1+1;
				x2 = res.peek().x2+1; y2 = res.peek().y2+1;
				x3 = res.peek().x3+1; y3 = res.peek().y3+1;
				out.println(x1 + " " + y1  + " " + x2 + " "  + y2 + " " + x3 + " " + y3);
				res.poll();
			}
			//for (int i = 0; i < N; i++) {
				//out.println(grid[i]);
			//}
		}
		out.close();
	} 
	
	static void attack1() {
		ax = new int[3]; ay = new int[3];
		int zeroCnt = 0, idx = 0;
		for (int k = 0; k < 4 && idx < 3; k++) {
			if (grid[tx[k]][ty[k]] == '1') {
				ax[idx] = tx[k]; ay[idx] = ty[k];
				idx++;
				grid[tx[k]][ty[k]] = '0';
			}
			else if (grid[tx[k]][ty[k]] == '0' && zeroCnt < 2) {
				ax[idx] = tx[k]; ay[idx] = ty[k];
				zeroCnt++;
				idx++;
				grid[tx[k]][ty[k]] = '1';
			}
		}
		res.add(new Triple(ax[0], ay[0], ax[1], ay[1], ax[2], ay[2]));
	}
	
	static void attack2() {
		ax = new int[3]; ay = new int[3];
		int zeroCnt = 0, oneCnt = 0, idx = 0;
		for (int k = 0; k < 4 && idx < 3; k++) {
			if (grid[tx[k]][ty[k]] == '1' && oneCnt < 1) {
				ax[idx] = tx[k]; ay[idx] = ty[k];
				oneCnt++;
				idx++;
				grid[tx[k]][ty[k]] = '0';
			}
			else if (grid[tx[k]][ty[k]] == '0' && zeroCnt < 2) {
				ax[idx] = tx[k]; ay[idx] = ty[k];
				zeroCnt++;
				idx++;
				grid[tx[k]][ty[k]] = '1';
			}
		}
		res.add(new Triple(ax[0], ay[0], ax[1], ay[1], ax[2], ay[2]));
	}
	
	static void attack3() {
		ax = new int[3]; ay = new int[3];
		int idx = 0;
		for (int k = 0; k < 4 && idx < 3; k++) {
			if (grid[tx[k]][ty[k]] == '1') {
				ax[idx] = tx[k]; ay[idx] = ty[k];
				grid[tx[k]][ty[k]] = '0';
				idx++;
			}
		}
		res.add(new Triple(ax[0], ay[0], ax[1], ay[1], ax[2], ay[2]));
	}
	
	static class Triple {
		int x1, y1, x2, y2, x3, y3;
		Triple(int x1, int y1, int x2, int y2, int x3, int y3){
			this.x1 = x1; this.y1 = y1;
			this.x2 = x2; this.y2 = y2;
			this.x3 = x3; this.y3 = y3;
		}
	}
	
	static INPUT in = new INPUT(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	private static class INPUT {

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar, numChars;

		public INPUT (InputStream stream) {
			this.stream = stream;
		}

		public INPUT (String file) throws IOException {
			this.stream = new FileInputStream (file);
		}

		public int cscan () throws IOException {
			if (curChar >= numChars) {
				curChar = 0;
				numChars = stream.read (buf);
			}
			
			if (numChars == -1)
				return numChars;

			return buf[curChar++];
		}

		public int iscan () throws IOException {
			int c = cscan (), sgn = 1;
			
			while (space (c))
				c = cscan ();

			if (c == '-') {
				sgn = -1;
				c = cscan ();
			}

			int res = 0;

			do {
				res = (res << 1) + (res << 3);
				res += c - '0';
				c = cscan ();
			}
			while (!space (c));

			return res * sgn;
		}

		public String sscan () throws IOException {
			int c = cscan ();
			
			while (space (c))
				c = cscan ();

			StringBuilder res = new StringBuilder ();

			do {
				res.appendCodePoint (c);
				c = cscan ();
			}
			while (!space (c));

			return res.toString ();
		}

		public double dscan () throws IOException {
			int c = cscan (), sgn = 1;
			
			while (space (c))
				c = cscan ();

			if (c == '-') {
				sgn = -1;
				c = cscan ();
			}

			double res = 0;

			while (!space (c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * UTILITIES.fast_pow (10, iscan ());
				
				res *= 10;
				res += c - '0';
				c = cscan ();
			}

			if (c == '.') {
				c = cscan ();
				double m = 1;

				while (!space (c)) {
					if (c == 'e' || c == 'E')
						return res * UTILITIES.fast_pow (10, iscan ());

					m /= 10;
					res += (c - '0') * m;
					c = cscan ();
				}
			}

			return res * sgn;
		}

		public long lscan () throws IOException {
			int c = cscan (), sgn = 1;
			
			while (space (c))
				c = cscan ();

			if (c == '-') {
				sgn = -1;
				c = cscan ();
			}

			long res = 0;

			do {
				res = (res << 1) + (res << 3);
				res += c - '0';
				c = cscan ();
			}
			while (!space (c));

			return res * sgn;
		}

		public boolean space (int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}

	public static class UTILITIES {

		static final double EPS = 10e-6;

		public static int lower_bound (int[] arr, int x) {
			int low = 0, high = arr.length, mid = -1;

			while (low < high) {
				mid = (low + high) / 2;

				if (arr[mid] >= x)
					high = mid;
				else
					low = mid + 1;
			}

			return low;
		}

		public static int upper_bound (int[] arr, int x) {
			int low = 0, high = arr.length, mid = -1;

			while (low < high) {
				mid = (low + high) / 2;

				if (arr[mid] > x)
					high = mid;
				else
					low = mid + 1;
			}

			return low;
		}

		public static int gcd (int a, int b) {
			return b == 0 ? a : gcd (b, a % b);
		}

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

		public static long fast_pow_mod (long b, long x, int mod) {
			if (x == 0) return 1;
			if (x == 1) return b;
			if (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;

			return b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;
		}

		public static int fast_pow (int b, int x) {
			if (x == 0) return 1;
			if (x == 1) return b;
			if (x % 2 == 0) return fast_pow (b * b, x / 2);

			return b * fast_pow (b * b, x / 2);
		}

		public static long choose (long n, long k) {
			k = Math.min (k, n - k);
			long val = 1;

			for (int i = 0; i < k; ++i)
				val = val * (n - i) / (i + 1);

			return val;
		}

		public static long permute (int n, int k) {
			if (n < k) return 0;
			long val = 1;

			for (int i = 0; i < k; ++i)
				val = (val * (n - i));

			return val;
		}
	}
}