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:
//package div3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class board
{
    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;
        }
    }



    /*
            BABB
            BAABBB

            AAAAABBB

    *  AABBBABBBB
    *
    * AABABB
    *
    * */
    static void helper(String s,int[] a,int n,String match,int inc){
        int i=0;
        while(i<n){
            int j = i;
            if(j+inc-1<=n-1 && s.substring(j,j+inc).equals(match)){
                a[j] = 1;
                i = j+inc-1;
            }
            else{
                i++;
            }
        }

    }
    static final int MAXN = 100000;
    static final int level = 18;



    //static LinkedList<Integer>[] adj;


    static int[] diameter;
    static int bfs(int init, int n)
    {
        // Initializing queue
        Queue<Integer> q = new LinkedList<>();
        q.add(init);

        int visited[] = new int[n + 1];
        for (int i = 0; i <= n; i++)
        {
            visited[i] = 0;
            diameter[i] = 0;
        }

        // Pushing each node in queue
        q.add(init);

        // Mark the traversed node visited
        visited[init] = 1;
        while (q.size() > 0)
        {
            int u = q.peek();
            q.remove();
            for (int nei : adj[u])
            {
                if (visited[nei] == 0)
                {
                    visited[nei] = 1;

                    // Considering weight of edges equal to 1
                    diameter[nei] += diameter[u] + 1;
                    q.add(nei);
                }
            }
        }
        int in = 0;
        for(int i = 0; i <= n; i++)
        {
            if(diameter[i] > diameter[in])
                in = i;
        }

        // return index of max value in diameter
        return in;
    }
    private static int dfs(int node,LinkedList<Integer>[] adj,int parent,int[] sub){

        int size = 1;
        for(int nei : adj[node]){
            if(nei != parent){
                size += dfs(nei,adj,node,sub);
            }
        }
        sub[node] = size;
        return size;
    }
    private static int dfs2(int node,LinkedList<Integer>[] adj,int parent,int[] sub){
        int res = sub[node];
        int maxScore = 0;
        for(int nei : adj[node]){
            if(nei != parent) {
                maxScore = Math.max(maxScore,dfs2(nei,adj,node,sub));
            }
        }
        return res + maxScore;
    }
    public static void primeFactors(long n)
    {
        // Print the number of 2s that divide n
        while (n%2==0)
        {
            primesMap.put((long)2,primesMap.getOrDefault((long)2,0)+1);
            n /= 2;
        }

        // n must be odd at this point.  So we can
        // skip one element (Note i = i +2)
        for (int i = 3; i <= Math.sqrt(n); i+= 2)
        {
            // While i divides n, print i and divide n
            while (n%i == 0)
            {
                primesMap.put((long)i,primesMap.getOrDefault((long)i,0)+1);
                n /= i;
            }
        }

        // This condition is to handle the case whien
        // n is a prime number greater than 2
        if (n > 2)
            primesMap.put(n,primesMap.getOrDefault(n,0)+1);
    }
    static TreeMap<Long,Integer> primesMap;
    /*
    *
    *  2 2 2 1 3 4 5
    *  1 2 2 2 3 3 2 1 2 2 2
    * */
    static LinkedList<Integer>[] adj;
    static int[] color;
    static int[] parent;
    static int cycle_end;
    static int cycle_start;
    static int n;
    static HashSet<Integer> cycle;
    static boolean dfs(int v, int par) { // passing vertex and its parent vertex
        color[v] = 1;
        for (int u : adj[v]) {
            if(u == par) continue; // skipping edge to parent vertex
            if (color[u] == 0) {
                parent[u] = v;
                if (dfs(u, parent[u]))
                    return true;
            } else if (color[u] == 1) {
                cycle_end = v;
                cycle_start = u;
                return true;
            }
        }
        color[v] = 2;
        return false;
    }
    static void find_cycle() {
        Arrays.fill(color,0);
        Arrays.fill(parent,-1);
        cycle_start = -1;

        for (int v = 0; v <= n; v++) {
            if (color[v] == 0 && dfs(v, parent[v]))
                break;
        }



        cycle.add(cycle_start);
        for (int v = cycle_end; v != cycle_start; v = parent[v])
            cycle.add(v);
        cycle.add(cycle_start);
        //System.out.println(cycle);

    }
    static int dfs2(int node,int par){
        int s = 1;
        for(int nei: adj[node]){
            if(!cycle.contains(nei) && nei != par){
                s += dfs2(nei,node);
            }
        }
        return s;
    }
    static long nC2(int n){
        return ((long)(n)*(long)(n-1))/2;
    }
    static int[][] d = new int[][]{{0,0},{1,0},{0,1},{1,1}};
    public static void main(String[] args)
    {
        FastReader sc=new FastReader();
        PrintWriter out = new PrintWriter(System.out);

        int t = sc.nextInt();

        while(t-->0){
            int n = sc.nextInt();
            int m = sc.nextInt();
            //System.out.println("hi");
            int[][] mat = new int[n][m];
            for(int i=0;i<n;i++){
                String s = sc.nextLine();
                for(int j=0;j<m;j++){
                    mat[i][j] = s.charAt(j)-'0';
                }
            }
            int sub_square_sum = 0;
            List<String> str = new ArrayList<>();
            for(int i=0;i<n-1;i++){
                for(int j=0;j<m-1;j++){
                    //System.out.println(i+" "+j);
                    //sub_square_sum = mat[i][j]+mat[i][j+1]+mat[i+1][j]+mat[i+1][j+1];
                    List<String[]> ones = new ArrayList<>();
                    List<String[]> zeros = new ArrayList<>();
                    //System.out.println("hi");
                    for(int[] a:d){
                        int nr = i+a[0], nc = j+a[1];
                        if(mat[nr][nc] == 1) ones.add(new String[]{Integer.toString(nr+1),Integer.toString(nc+1)});
                        else zeros.add(new String[]{Integer.toString(nr+1),Integer.toString(nc+1)});
                        mat[nr][nc] = 0;
                    }
                    //System.out.println(ones);
                    if(ones.size() == 1){
                        str.add(zeros.get(0)[0]+" "+zeros.get(0)[1]+" "+zeros.get(1)[0]+" "+zeros.get(1)[1]+" "+ones.get(0)[0]+" "+ones.get(0)[1]);
                        str.add(zeros.get(0)[0]+" "+zeros.get(0)[1]+" "+zeros.get(2)[0]+" "+zeros.get(2)[1]+" "+ones.get(0)[0]+" "+ones.get(0)[1]);
                        str.add(zeros.get(1)[0]+" "+zeros.get(1)[1]+" "+zeros.get(2)[0]+" "+zeros.get(2)[1]+" "+ones.get(0)[0]+" "+ones.get(0)[1]);
                    }
                    else if(ones.size() == 2){
                        str.add(zeros.get(0)[0]+" "+zeros.get(0)[1]+" "+zeros.get(1)[0]+" "+zeros.get(1)[1]+" "+ones.get(0)[0]+" "+ones.get(0)[1]);
                        str.add(zeros.get(0)[0]+" "+zeros.get(0)[1]+" "+zeros.get(1)[0]+" "+zeros.get(1)[1]+" "+ones.get(1)[0]+" "+ones.get(1)[1]);
                    }
                    else if(ones.size() == 3){
                        str.add(ones.get(0)[0]+" "+ones.get(0)[1]+" "+ones.get(1)[0]+" "+ones.get(1)[1]+" "+ones.get(2)[0]+" "+ones.get(2)[1]);
                    }
                    else if(ones.size() == 4){
                        str.add(ones.get(0)[0]+" "+ones.get(0)[1]+" "+ones.get(1)[0]+" "+ones.get(1)[1]+" "+ones.get(2)[0]+" "+ones.get(2)[1]);
                        str.add(ones.get(3)[0]+" "+ones.get(3)[1]+" "+ones.get(1)[0]+" "+ones.get(1)[1]+" "+ones.get(2)[0]+" "+ones.get(2)[1]);
                        str.add(ones.get(0)[0]+" "+ones.get(0)[1]+" "+ones.get(3)[0]+" "+ones.get(3)[1]+" "+ones.get(2)[0]+" "+ones.get(2)[1]);
                        str.add(ones.get(0)[0]+" "+ones.get(0)[1]+" "+ones.get(1)[0]+" "+ones.get(1)[1]+" "+ones.get(3)[0]+" "+ones.get(3)[1]);
                    }

                }

            }

            out.println(str.size());
            for(String s:str) out.println(s);

        }
        out.close();
    }


}