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 long m = (long) (1e9 + 7);

	public static void main(String[] args) throws IOException {
		Scanner scn = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int T = scn.nextInt(), tcs = 0;
		C: while (tcs++ < T) {
			int n = scn.nextInt(), m = scn.nextInt();
			int mt[][] = new int[n + 1][m + 1];
			for (int i = 1; i <= n; i++) {
				String s = scn.next();
				for (int j = 1; j <= m; j++) {
					mt[i][j] = s.charAt(j - 1) - '0';
				}
			}
			int k = 0;
			StringBuilder ss = new StringBuilder();
			for (int i = 1; i <= n; i += 2) {
				for (int j = 1; j <= m; j += 2) {
					int c = 0;

					int x1 = i, x2 = i + 1;
					int y1 = j, y2 = j + 1;
					boolean bx = false, by = false;
					if (x1 == n) {
						bx = true;
						int tp = x1;
						x1 = i - 1;
						x2 = tp;
					}
					if (y1 == m) {
						by = true;
						int tp = y1;
						y1 = j - 1;
						y2 = tp;
					}
					if (bx) {
						mt[x1][y1] = 0;
						mt[x1][y2] = 0;
					}
					if (by) {
						mt[x1][y1] = 0;
						mt[x2][y1] = 0;
					}
					ArrayList<int[]> l = new ArrayList<>();
					if (mt[x1][y2] == 1) {
						c++;
						l.add(new int[] { x1, y2 });
					}
					if (mt[x1][y1] == 1) {
						c++;
						l.add(new int[] { x1, y1 });
					}
					if (mt[x2][y1] == 1) {
						c++;
						l.add(new int[] { x2, y1 });
					}
					if (mt[x2][y2] == 1) {
						c++;
						l.add(new int[] { x2, y2 });
					}
					if (c == 4) {
						k += 4;
						f4(l, x1, x2, y1, y2, ss);
					} else if (c == 1) {
						k += 3;
						f1(l, x1, x2, y1, y2, ss);
					} else if (c == 2) {
						k += 2;
						f2(l, x1, x2, y1, y2, ss);
					} else if (c == 3) {
						k += 1;
						f3(l, x1, x2, y1, y2, ss);
					}
				}
			}
			sb.append(k + "\n" + ss);
		}
		System.out.print(sb);
	}

	public static void f4(ArrayList<int[]> l, int x1, int x2, int y1, int y2, StringBuilder sb) {
		for (int i = 0; i < 3; i++) {
			sb.append(l.get(i)[0] + " " + l.get(i)[1] + " ");
		}
		sb.append("\n");
		ArrayList<int[]> ll = new ArrayList<>();
		ll.add(new int[] { l.get(3)[0], l.get(3)[1] });
		f1(ll, x1, x2, y1, y2, sb);
	}

	public static void f1(ArrayList<int[]> l, int x1, int x2, int y1, int y2, StringBuilder sb) {
		if (x1 == l.get(0)[0] && y1 == l.get(0)[1]) {
			sb.append(x1 + " " + y1 + " " + x1 + " " + y2 + " " + x2 + " " + y1 + "\n");
			ArrayList<int[]> l2 = new ArrayList<>();
			l2.add(new int[] { x1, y2 });
			l2.add(new int[] { x2, y1 });
			f2(l2, x1, x2, y1, y2, sb);
		} else if (x1 == l.get(0)[0] && y2 == l.get(0)[1]) {
			sb.append(x1 + " " + y2 + " " + x1 + " " + y1 + " " + x2 + " " + y2 + "\n");
			ArrayList<int[]> l2 = new ArrayList<>();
			l2.add(new int[] { x1, y1 });
			l2.add(new int[] { x2, y2 });
			f2(l2, x1, x2, y1, y2, sb);
		} else if (x2 == l.get(0)[0] && y1 == l.get(0)[1]) {
			sb.append(x2 + " " + y1 + " " + x2 + " " + y2 + " " + x1 + " " + y1 + "\n");
			ArrayList<int[]> l2 = new ArrayList<>();
			l2.add(new int[] { x1, y1 });
			l2.add(new int[] { x2, y2 });
			f2(l2, x1, x2, y1, y2, sb);
		} else if (x2 == l.get(0)[0] && y2 == l.get(0)[1]) {
			sb.append(x2 + " " + y2 + " " + x1 + " " + y2 + " " + x2 + " " + y1 + "\n");
			ArrayList<int[]> l2 = new ArrayList<>();
			l2.add(new int[] { x1, y2 });
			l2.add(new int[] { x2, y1 });
			f2(l2, x1, x2, y1, y2, sb);
		}
	}

	public static void f2(ArrayList<int[]> l, int x1, int x2, int y1, int y2, StringBuilder sb) {
		if (l.get(0)[0] == l.get(1)[0]) {
			if (x1 == l.get(0)[0]) {
				sb.append(x1 + " " + y1 + " " + x2 + " " + y1 + " " + x2 + " " + y2 + "\n");
				ArrayList<int[]> l2 = new ArrayList<>();
				l2.add(new int[] { x1, y2 });
				l2.add(new int[] { x2, y2 });
				l2.add(new int[] { x2, y1 });
				f3(l2, x1, x2, y1, y2, sb);
			} else {
				sb.append(x2 + " " + y1 + " " + x1 + " " + y1 + " " + x1 + " " + y2 + "\n");
				ArrayList<int[]> l2 = new ArrayList<>();
				l2.add(new int[] { x1, y2 });
				l2.add(new int[] { x2, y2 });
				l2.add(new int[] { x1, y1 });
				f3(l2, x1, x2, y1, y2, sb);
			}
		} else if (l.get(0)[1] == l.get(1)[1]) {
			if (y1 == l.get(0)[1]) {
				sb.append(x1 + " " + y1 + " " + x2 + " " + y2 + " " + x1 + " " + y2 + "\n");
				ArrayList<int[]> l2 = new ArrayList<>();
				l2.add(new int[] { x1, y2 });
				l2.add(new int[] { x2, y2 });
				l2.add(new int[] { x2, y1 });
				f3(l2, x1, x2, y1, y2, sb);
			} else {
				sb.append(x2 + " " + y1 + " " + x2 + " " + y2 + " " + x1 + " " + y1 + "\n");
				ArrayList<int[]> l2 = new ArrayList<>();
				l2.add(new int[] { x1, y2 });
				l2.add(new int[] { x2, y1 });
				l2.add(new int[] { x1, y1 });
				f3(l2, x1, x2, y1, y2, sb);
			}
		} else {
			if ((x1 == l.get(0)[0] && y1 == l.get(0)[1]) || (x1 == l.get(1)[0] && y1 == l.get(1)[1])) {
				sb.append(x1 + " " + y1 + " " + x1 + " " + y2 + " " + x2 + " " + y1 + "\n");
				ArrayList<int[]> l2 = new ArrayList<>();
				l2.add(new int[] { x1, y2 });
				l2.add(new int[] { x2, y1 });
				l2.add(new int[] { x2, y2 });
				f3(l2, x1, x2, y1, y2, sb);
			} else {
				sb.append(x1 + " " + y1 + " " + x1 + " " + y2 + " " + x2 + " " + y2 + "\n");
				ArrayList<int[]> l2 = new ArrayList<>();
				l2.add(new int[] { x2, y1 });
				l2.add(new int[] { x2, y2 });
				l2.add(new int[] { x1, y1 });
				f3(l2, x1, x2, y1, y2, sb);
			}
		}
	}

	public static void f3(ArrayList<int[]> l, int x1, int x2, int y1, int y2, StringBuilder sb) {
		for (int a[] : l) {
			sb.append(a[0] + " " + a[1] + " ");
		}
		sb.append("\n");
	}

	public static long[] shuffle(long[] a) {
		Random gen = new Random();
		for (int i = 0, n = a.length; i < n; i++) {
			int ind = gen.nextInt(n - i) + i;
			long d = a[i];
			a[i] = a[ind];
			a[ind] = d;
		}
		return a;
	}

	static class Scanner {

		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

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