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.math.BigInteger;
import java.util.*;

public class Contest {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args) {
        new Contest().run();
    }

    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time(ms) = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    class MyComparator implements Comparable<MyComparator> {

        int x;
        int y;

        public MyComparator(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(MyComparator a) {
            if (x == a.x) {
                return (y - a.y);
            }
            return x - a.x;
        }
    }

    public static boolean isPrime(int num) {
        if (num > 2 && num % 2 == 0) {
            //System.out.println(num + " is not prime");
            return false;
        }
        int top = (int) Math.sqrt(num) + 1;
        for (int i = 3; i < top; i += 2) {
            if (num % i == 0) {
                //System.out.println(num + " is not prime");
                return false;
            }
        }
        //System.out.println(num + " is prime");
        return true;
    }

    private static long gcd(long a, long b) {
        BigInteger b1 = BigInteger.valueOf(a);
        BigInteger b2 = BigInteger.valueOf(b);
        BigInteger gcd = b1.gcd(b2);
        return gcd.longValue();
    }

    static int floorSqrt(int x) {
        // Base cases 
        if (x == 0 || x == 1) {
            return x;
        }

        int i = 1, result = 1;

        while (result <= x) {
            i++;
            result = i * i;
        }

        return i;
    }

    public void solveE() throws IOException {

    }

    public void solveD() throws IOException {
        int n = readInt();
        int m = readInt();
        String s1 = readString();
        String s2 = readString();
    }

    public void solveC2() throws IOException {

    }

    public void solve() throws IOException {
        int t = readInt();
        outerloop:
        for (int i = 0; i < t; i++) {
            int n = readInt();
            int m = readInt();
            int[][] array = new int[n][m];
            for (int j = 0; j < n; j++) {
                String s = readString();
                String[] split = s.split("");
                for (int k = 0; k < m; k++) {
                    array[j][k] = Integer.valueOf(split[k]);
                }
            }
            int sum = 0;
            StringBuilder builder = new StringBuilder();
            for (int j = 0; j < n; j++) {
                for (int k = 0; k < m; k++) {
                    if (array[j][k] == 1) {
                        sum += 3;
                        if (j == 0 && k == 0) {
                            changePoint(j + 1, k, true, false, builder);
                            changePoint(j, k + 1, false, true, builder);
                            changePoint(j + 1, k + 1, false, false, builder);
                        } else if (j == 0) {
                            changePoint(j + 1, k, false, false, builder);
                            changePoint(j, k - 1, true, true, builder);
                            changePoint(j + 1, k - 1, true, false, builder);
                        } else if (k == 0) {
                            changePoint(j - 1, k, true, true, builder);
                            changePoint(j, k + 1, false, false, builder);
                            changePoint(j - 1, k + 1, false, true, builder);
                        } else {
                            changePoint(j - 1, k, false, true, builder);
                            changePoint(j, k - 1, true, false, builder);
                            changePoint(j - 1, k - 1, true, true, builder);
                        }
                    }
                }
            }
            System.out.println(sum);
            if (sum == 0) {
                continue;
            }
            builder.setLength(builder.length() - 1);
            System.out.println(builder);
        }
    }

    private void changePoint(int j, int k, boolean right, boolean down, StringBuilder builder) {
        //System.out.println("j:" + j);
        //System.out.println("k:" + k);
        if (right && down) {
            builder.append(j + 1 + 1).append(" ");
            builder.append(k + 1).append(" ");
            builder.append(j + 1).append(" ");
            builder.append(k + 1 + 1).append(" ");
            builder.append(j + 1 + 1).append(" ");
            builder.append(k + 1 + 1).append("\n");
        } else if (down) {
            builder.append(j + 1 + 1).append(" ");
            builder.append(k + 1).append(" ");
            builder.append(j + 1).append(" ");
            builder.append(k - 1 + 1).append(" ");
            builder.append(j + 1 + 1).append(" ");
            builder.append(k - 1 + 1).append("\n");
        } else if (right) {
            builder.append(j - 1 + 1).append(" ");
            builder.append(k + 1).append(" ");
            builder.append(j + 1).append(" ");
            builder.append(k + 1 + 1).append(" ");
            builder.append(j - 1 + 1).append(" ");
            builder.append(k + 1 + 1).append("\n");
        } else {
            builder.append(j - 1 + 1).append(" ");
            builder.append(k + 1).append(" ");
            builder.append(j + 1).append(" ");
            builder.append(k - 1 + 1).append(" ");
            builder.append(j - 1 + 1).append(" ");
            builder.append(k - 1 + 1).append("\n");
        }
    }

    public void solveB() throws IOException {
        int t = readInt();
        for (int i = 0; i < t; i++) {
            int n = readInt();
            int k = readInt();
            List<Integer> list = new ArrayList<>();
            for (int j = 0; j < n * k; j++) {
                list.add(readInt());
            }
            long sum = 0;
            int left = n / 2 + n % 2 - 1;
            int right = n - (n / 2 + n % 2);
            //System.out.println("right:" + right);
            int counter = 0;
            for (int j = k * n - right - 1; j >= left * counter; j -= right + 1) {
                //System.out.println(list.get(j));
                sum += list.get(j);
                counter++;
            }
            System.out.println(sum);
        }
    }

    public void solveA() throws IOException {
        int t = readInt();
        for (int i = 0; i < t; i++) {
            int n = readInt();
            int c0 = readInt();
            int c1 = readInt();
            int h = readInt();
            String s = readString();
            String[] str = s.split("");
            int delta = c1 - c0;
            int sum = 0;
            for (int j = 0; j < n; j++) {
                if (delta > h && str[j].equals("1")) {
                    sum += h;
                    sum += c0;
                } else if (delta < -h && str[j].equals("0")) {
                    sum += h;
                    sum += c1;
                } else if (str[j].equals("1")) {
                    sum += c1;
                } else if (str[j].equals("0")) {
                    sum += c0;
                } else {
                    throw new IllegalStateException();
                }
            }

            System.out.println(sum);
        }
    }

}