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.*;
import java.math.*;
import java.math.BigInteger;
import java.util.LinkedList; 
import java.util.Queue; 
public final class CodeForces
{    
    static StringBuilder ans=new StringBuilder();
    static FastReader in=new FastReader();
    static ArrayList<ArrayList<Integer>> g;
    static long mod=1000000007;
    static boolean set[];   
    static long seg[];
    static long A[];
    public static void main(String args[])throws IOException
    {
        int T=i();
        while(T-->0)
        {
            int N=i();
            int M=i();
            int A[][]=new int[N+1][M+1];
            for(int i=1; i<=N; i++)
            {
                String X=in.next();
                for(int j=1; j<=M; j++)
                    A[i][j]=X.charAt(j-1)-'0';
            }
            int c=0;
            for(int i=1; i<N; i++)
            {
                for(int j=1; j<M; j++)
                {
                    if(A[i][j]==1)
                    {
                        c++;
                        A[i+1][j]=(A[i+1][j]+1)%2;
                        A[i][j+1]=(A[i][j+1]+1)%2;
                        ans.append(i+" "+j+" "+(i+1)+" "+j+" "+i+" "+(j+1)+"\n");

                    }
                }
            }
            int j=M; 
            for(int i=1; i<N; i++)
            {
                if(A[i][j]==1)
                {
                    c+=2;
                    A[i+1][j]=(A[i+1][j]+1)%2;
                    ans.append(i+" "+j+" "+(i+1)+" "+(j-1)+" "+i+" "+(j-1)+"\n");
                    ans.append((i+1)+" "+(j)+" "+(i+1)+" "+(j-1)+" "+(i)+" "+(j-1)+"\n");
                }
            }
            int i=N;
            for(j=1; j<M; j++)
            {
                if(A[i][j]==1)
                {
                    c+=2;
                    A[i][j+1]=(A[i][j+1]+1)%2;
                    ans.append(i+" "+j+" "+(i-1)+" "+j+" "+(i-1)+" "+(j+1)+"\n");
                    ans.append((i)+" "+(j+1)+" "+(i-1)+" "+j+" "+(i-1)+" "+(j+1)+"\n");

                }
            }
            if(A[N][M]==1)
            {
                c+=3;
                ans.append(N+" "+M+" "+N+" "+(M-1)+" "+(N-1)+" "+M+"\n");
                ans.append(N+" "+M+" "+N+" "+(M-1)+" "+(N-1)+" "+(M-1)+"\n");
                ans.append(N+" "+M+" "+(N-1)+" "+(M-1)+" "+(N-1)+" "+M+"\n");
            }
            System.out.println(c);
            System.out.print(ans);
            ans.delete(0,ans.length());
        }
    }

    static void update(int v,int tl,int tr,int pos,long value)
    {
        if(tl==tr)seg[v]=value;
        else
        {
            int tm=(tl+tr)/2;
            if(pos<=tm)
            {
                update(2*v,tl,tm,pos,value);
            }
            else
            {
                update(2*v+1,tm+1,tr,pos,value);
            }
            seg[v]=Math.min(seg[2*v],seg[2*v+1]);
        }
    }

    static void build(int v,int l, int r)
    {
        if(l==r)
        {
            seg[v]=A[l];
        }
        else
        {
            int m=(l+r)/2;
            build(2*v,l,m);
            build(2*v+1,m+1,r);
            seg[v]=Math.min(seg[2*v],seg[2*v+1]);
        }      
    }

    static long sum(int v,int tl,int tr,int l,int r)
    {
        if(l>r)return 0;
        if(l==tl && r==tr)
        {
            return seg[v];
        }
        else 
        {
            int tm=(tr+tl)/2;
            return Math.min(sum(2*v,tl,tm,l,Math.min(r,tm)),sum(2*v+1,tm+1,tr,Math.max(l,tm+1),r));
        }
    }

    static void sort(long[] a) //check for long
    {
        ArrayList<Long> l=new ArrayList<>();
        for (long i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static String swap(String X,int i,int j)
    {
        char ch[]=X.toCharArray();
        char a=ch[i];
        ch[i]=ch[j];
        ch[j]=a;
        return new String(ch);
    }

    static int sD(long n)  
    {  

        if (n % 2 == 0 )  
            return 2;  

        for (int i = 3; i * i <= n; i += 2) {  
            if (n % i == 0 )  
                return i;  
        }  

        return (int)n;  
    }  

    static void setGraph(int N)
    {
        set=new boolean[N+1];
        g=new ArrayList<ArrayList<Integer>>();
        for(int i=0; i<=N; i++)
            g.add(new ArrayList<Integer>());
    }

    static void DFS(int N,int d)
    {
        set[N]=true;
        d++;
        for(int i=0; i<g.get(N).size(); i++)
        {
            int c=g.get(N).get(i);
            if(set[c]==false)
            {
                DFS(c,d);
            }
        }
    }

    static  long pow(long a,long b)
    {
        long mod=1000000007;
        long pow=1;
        long x=a;
        while(b!=0)
        {
            if((b&1)!=0)pow=(pow*x)%mod;
            x=(x*x)%mod;
            b/=2;
        }
        return pow;
    }

    static long toggleBits(long x)//one's complement || Toggle bits
    {
        int n=(int)(Math.floor(Math.log(x)/Math.log(2)))+1;

        return ((1<<n)-1)^x;
    }

    static int countBits(long a)
    {
        return (int)(Math.log(a)/Math.log(2)+1);
    }

    static long fact(long N)
    { 
        long n=2; 
        if(N<=1)return 1;
        else
        {
            for(int i=3; i<=N; i++)n=(n*i)%mod;
        }
        return n;
    }

    static int kadane(int A[])
    {
        int lsum=A[0],gsum=A[0];
        for(int i=1; i<A.length; i++)
        {
            lsum=Math.max(lsum+A[i],A[i]);
            gsum=Math.max(gsum,lsum);
        }
        return gsum;
    }

    static void sort(int[] a) {
        ArrayList<Integer> l=new ArrayList<>();
        for (int i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static boolean isPrime(long N)
    {
        if (N<=1)  return false; 
        if (N<=3)  return true; 
        if (N%2 == 0 || N%3 == 0) return false; 
        for (int i=5; i*i<=N; i=i+6) 
            if (N%i == 0 || N%(i+2) == 0) 
                return false; 
        return true; 
    }

    static int i()
    {
        return in.nextInt();
    }

    static long l()
    {
        return in.nextLong();
    }

    static int[] input(int N){
        int A[]=new int[N];
        for(int i=0; i<N; i++)
        {
            A[i]=in.nextInt();
        }
        return A;
    }

    static long[] inputLong(int N)     {
        long A[]=new long[N];
        for(int i=0; i<A.length; i++)A[i]=in.nextLong();
        return A;
    }

    static long GCD(long a,long b) 
    {
        if(b==0)
        {
            return a;
        }
        else return GCD(b,a%b );
    }

}
//Code For FastReader
//Code For FastReader
//Code For FastReader
//Code For FastReader
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;
    }

}