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.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        Scanner in = new Main().new Scanner(inputStream);
        Main solver = new Main();
        solver.runn(in);
    }

    public void runn(Scanner in) {
        int t = in.ni();
        while (t-- > 0) {
            int n = in.ni(), m = in.ni();
            boolean[][] g = new boolean[n][m];
            for (int i = 0; i < n; i++) {
                String line = in.rl();
                for (int j = 0; j < m; j++)
                    g[i][j] = (line.charAt(j) == '1');
            }
            for (int i = 0; i < n / 2 * 2; i += 2) {
                for (int j = 0; j < m / 2 * 2; j += 2) {
                    change(g, i, j);
                }
            }

            if (n % 2 == 1)
                for (int i = 0; i < m - 1; i += 1)
                    change(g, n - 2, i);
            if (m % 2 == 1)
                for (int i = 0; i < n - 1; i += 1)
                    change(g, i, m - 2);
            System.out.println(prints.size());
            for (String pp : prints) {
                System.out.println(pp);
            }
            prints = new ArrayList<>();
        }
    }

    public void change(boolean[][] grid, int x, int y) {
        List<Pair> used = new ArrayList<>();
        List<Pair> unused = new ArrayList<>();
        for (int i = 0; i < 2; i++)
            for (int j = 0; j < 2; j++) {
                if (grid[i + x][j + y])
                    used.add(new Pair(i + x, j + y));
                else
                    unused.add(new Pair(i + x, j + y));
            }
        if (used.size() == 4) {
            print(grid, used.get(0), used.get(1), used.get(2));
            change(grid, x, y);
        } else if (used.size() == 1 || used.size() == 2) {
            print(grid, unused.get(0), unused.get(1), used.get(0));
            change(grid, x, y);
        } else if (used.size() == 3) {
            print(grid, used.get(0), used.get(1), used.get(2));
        }
    }

    List<String> prints = new ArrayList<>();

    public void print(boolean[][] g, Pair p1, Pair p2, Pair p3) {
        Pair[] ps = { p1, p2, p3 };
        StringBuilder sb = new StringBuilder();
        for (Pair flip : ps) {
            g[flip.firsti()][flip.secondi()] = !g[flip.firsti()][flip.secondi()];
            sb.append((flip.firsti() + 1) + " " + (flip.secondi() + 1) + " ");
        }
        prints.add(sb.toString());
    }

    class Scanner {
        BufferedReader br;
        StringTokenizer in;

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

        public String next() {
            return hasMoreTokens() ? in.nextToken() : null;
        }

        public String rl() {
            try {
                return br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
                return null;
            }
        }

        boolean hasMoreTokens() {
            while (in == null || !in.hasMoreTokens()) {
                String s = rl();
                if (s == null)
                    return false;
                in = new StringTokenizer(s);
            }
            return true;
        }

        public String nextString() {
            return next();
        }

        public int ni() {
            return Integer.parseInt(nextString());
        }

        public double nd() {
            return Double.parseDouble(nextString());
        }

        public long nl() {
            return Long.parseLong(nextString());
        }

        public int[] nia(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public long[] nla(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
    }

    class Pair implements Comparable<Pair> {
        long _first, _second;

        public Pair(int f, int s) {
            _first = f;
            _second = s;
        }

        public Pair(Long f, Long s) {
            _first = f;
            _second = s;
        }

        public int compareTo(Pair o) {
            if (this.first() != o.first())
                return Long.compare(this.first(), o.first());
            else
                return Long.compare(this.second(), o.second());
        }

        long first() {
            return _first;
        }

        long second() {
            return _second;
        }

        int firsti() {
            return (int) _first;
        }

        int secondi() {
            return (int) _second;
        }
    }

    class Triple implements Comparable<Triple> {
        Integer _first, _second, _third;

        public Triple(Integer f, Integer s, Integer t) {
            _first = f;
            _second = s;
            _third = t;
        }

        public int compareTo(Triple o) {
            if (!this.first().equals(o.first()))
                return this.first() - o.first();
            else if (!this.second().equals(o.second()))
                return this.second() - o.second();
            else
                return this.third() - o.third();
        }

        Integer first() {
            return _first;
        }

        Integer second() {
            return _second;
        }

        Integer third() {
            return _third;
        }

        public String toString() {
            return first() + " " + second() + " " + third();
        }
    }
}