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 FastReader reader = new FastReader();
    static OutputWriter out = new OutputWriter(System.out);


    static void one(int i, int j, int[][] arr, List<int[]> res) {
        //two zero and one
        int[] op = new int[6];
        int[] one = getOne(i, j, arr);
        int[] z1 = getZero(i, j, arr);
        op[2] = z1[0]; op[3] = z1[1]; arr[z1[0]][z1[1]] = 1;
        int[] z2 = getZero(i, j, arr);
        op[0] = one[0]; op[1] = one[1]; arr[one[0]][one[1]] = 0;
        op[4] = z2[0]; op[5] = z2[1]; arr[z2[0]][z2[1]] = 1;
        res.add(op);
        two(i, j, arr, res);
    }

    static void two(int i, int j, int[][] arr, List<int[]> res) {
        //two zero and one
        int[] op = new int[6];
        int[] one = getOne(i, j, arr);
        int[] z1 = getZero(i, j, arr);
        op[2] = z1[0]; op[3] = z1[1]; arr[z1[0]][z1[1]] = 1;
        int[] z2 = getZero(i, j, arr);
        op[0] = one[0]; op[1] = one[1]; arr[one[0]][one[1]] = 0;
        op[4] = z2[0]; op[5] = z2[1]; arr[z2[0]][z2[1]] = 1;
        res.add(op);
        three(i, j, arr, res);
    }

    static void three(int i, int j, int[][] arr, List<int[]> res) {
        //three ones
        int[] op = new int[6];
        int[] o1 = getOne(i, j, arr);
        op[0] = o1[0]; op[1] = o1[1]; arr[o1[0]][o1[1]] = 0;
        int[] o2 = getOne(i, j, arr);
        op[2] = o2[0]; op[3] = o2[1]; arr[o2[0]][o2[1]] = 0;
        int[] o3 = getOne(i, j, arr);
        op[4] = o3[0]; op[5] = o3[1]; arr[o3[0]][o3[1]] = 0;
        res.add(op);
    }

    static int[] getOne(int i, int j, int[][] arr) {
        if(arr[i][j] == 1) return new int[] {i, j};
        if(arr[i+1][j] == 1) return new int[] {i + 1, j};
        if(arr[i][j+1] == 1) return new int[] {i, j + 1};
        if(arr[i+1][j+1] == 1) return new int[] {i+1, j+1};
        throw new RuntimeException();
    }

    static int[] getZero(int i, int j, int[][] arr) {
        if(arr[i][j] == 0) return new int[] {i, j};
        if(arr[i+1][j] == 0) return new int[] {i + 1, j};
        if(arr[i][j+1] == 0) return new int[] {i, j +1};
        if(arr[i+1][j+1] == 0) return new int[] {i+1, j+1};
        throw new RuntimeException();
    }

    static void four(int i, int j, int[][] arr, List<int[]> res) {
        int count = 0;
        int[] op = new int[6];
        int[] t = getOne(i, j, arr); op[count++] = t[0]; op[count++] = t[1]; arr[t[0]][t[1]] = 0;
        t = getOne(i, j, arr); op[count++] = t[0]; op[count++] = t[1]; arr[t[0]][t[1]] = 0;
        t = getOne(i, j, arr); op[count++] = t[0]; op[count++] = t[1]; arr[t[0]][t[1]] = 0;
        res.add(op);
        one(i, j, arr, res);
    }

    static void solve(int[][] arr) {
        int n = arr.length;
        int m = arr[0].length;
        List<int[]> ops = new ArrayList<>();
        for(int i = 0; i < n - 1; i++) {
            for(int j = 0; j < m -1; j++) {
                int c = 0;
                if(arr[i][j] == 1) c++;
                if(arr[i+1][j] == 1) c++;
                if(arr[i][j+1] == 1) c++;
                if(arr[i+1][j+1] == 1) c++;
                if(c == 0) continue;
                if(c == 1) one(i, j, arr, ops);
                if(c == 2) two(i, j, arr, ops);
                if(c == 3) three(i, j, arr, ops);
                if(c == 4) four(i, j, arr, ops);
            }
        }
        out.println(ops.size());
        for(int[] op : ops) {
            for(int i = 0; i < op.length; i++) {
                out.print((op[i] +1)+ " ");
            }
            out.println();
        }
    }

    public static void main(String[] args) {
        int tests = reader.nextInt();
        for(int test = 1; test <= tests; test++) {
            int n = reader.nextInt();
            int m = reader.nextInt();
            int[][] arr = new int[n][m];
            for(int i = 0; i < n; i++) {
                char[] temp = reader.nextLine().toCharArray();
                for(int j = 0; j < m; j++) {
                    arr[i][j] = Character.getNumericValue(temp[j]);
                }
            }
            solve(arr);
        }
        out.flush();
    }

    static final Random random = new Random();

    static void shuffleSort(int[] a) {
        int n = a.length;//shuffle, then sort
        for (int i = 0; i < n; i++) {
            int oi = random.nextInt(n), temp = a[oi];
            a[oi] = a[i];
            a[i] = temp;
        }
        Arrays.sort(a);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            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;
        }
    }

    public static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(char[] array) {
            writer.print(array);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void print(int[] array) {
            for (int i = 0; i < array.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(array[i]);
            }
        }

        public void print(double[] array) {
            for (int i = 0; i < array.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(array[i]);
            }
        }

        public void print(long[] array) {
            for (int i = 0; i < array.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(array[i]);
            }
        }

        public void println(int[] array) {
            print(array);
            writer.println();
        }

        public void println(double[] array) {
            print(array);
            writer.println();
        }

        public void println(long[] array) {
            print(array);
            writer.println();
        }

        public void println() {
            writer.println();
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void print(char i) {
            writer.print(i);
        }

        public void println(char i) {
            writer.println(i);
        }

        public void println(char[] array) {
            writer.println(array);
        }

        public void printf(String format, Object... objects) {
            writer.printf(format, objects);
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }

        public void print(long i) {
            writer.print(i);
        }

        public void println(long i) {
            writer.println(i);
        }

        public void print(int i) {
            writer.print(i);
        }

        public void println(int i) {
            writer.println(i);
        }

        public void separateLines(int[] array) {
            for (int i : array) {
                println(i);
            }
        }
    }
}