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 com.company;
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main{
    /*
     ** || ॐ श्री गणेशाय नमः ||
     ** @𝙖𝙪𝙩𝙝𝙤𝙧 𝙅𝙞𝙜𝙖𝙧_𝙉𝙖𝙞𝙣𝙪𝙟𝙞
     ** 𝙎𝙑𝙉𝙄𝙏-𝙎𝙐𝙍𝘼𝙏
     */
    public static void main(String args[]){
        PrintWriter out=new PrintWriter(System.out);
        InputReader in=new InputReader(System.in);
        TASK solver = new TASK();
        int t=1;
         t = in.nextInt();
        for(int i=0;i<t;i++)
        {
            solver.solve(in,out,i);
        }
        out.close();
    }
    static class TASK {
        static int mod = 1000000000+7;
       static int count(int x,int y,char[][] s)
       {
           int c = 0;
           if(s[x][y] == '1') c++;
           if(s[x+1][y] == '1') c++;
           if(s[x][y+1] == '1') c++;
           if(s[x+1][y+1] == '1') c++;
           return c;
       }

        void solve(InputReader in, PrintWriter out, int testNumber) {
            int n = in.nextInt();
            int m = in.nextInt();
            char[][] s = new char[n][n];
            for(int i=0;i<n;i++)
                s[i]=in.next().toCharArray();
            ArrayList<pair> a = new ArrayList<>();
            ArrayList<pair> b = new ArrayList<>();
            ArrayList<pair> c = new ArrayList<>();
            int left[] = {0 , 1 , 0 , 1}, right[] = {0 , 0 , 1 , 1};
            for(int i = 0 ; i < n-1 ; ++i) {
                for(int j = 0 ; j < m-1 ; ++j) {
                    int one = count(i , j,s);
                    ArrayList<pair> p = new ArrayList<>();
                    ArrayList<pair> q=new ArrayList<>();
                    for(int k = 0 ; k < 4 ; ++k) {
                        if(s[i+left[k]][j+right[k]] == '1') {
                            p.add (new pair(i+left[k] , j+right[k]));
                        }
                        else {
                            q.add(new pair(i+left[k] , j+right[k]));
                        }
                    }
                    if(one == 0) {
                        continue;
                    }
                    else if(one == 1) {
                        a.add(new pair(p.get(0).first , p.get(0).second));
                        b.add(new pair(q.get(0).first , q.get(0).second));
                        c.add(new pair(q.get(1).first , q.get(1).second));

                        a.add(new pair(p.get(0).first , p.get(0).second));
                        b.add(new pair(q.get(0).first , q.get(0).second));
                        c.add(new pair(q.get(2).first , q.get(2).second));

                        a.add(new pair(p.get(0).first , p.get(0).second));
                        b.add(new pair(q.get(2).first , q.get(2).second));
                        c.add(new pair(q.get(1).first , q.get(1).second));


                    }
                    else if(one == 2) {
                        a.add(new pair(p.get(0).first , p.get(0).second));
                        b.add(new pair(q.get(0).first , q.get(0).second));
                        c.add(new pair(q.get(1).first , q.get(1).second));

                        a.add(new pair(p.get(1).first , p.get(1).second));
                        b.add(new pair(q.get(0).first , q.get(0).second));
                        c.add(new pair(q.get(1).first , q.get(1).second));
                    }
                    else if(one == 3) {
                        a.add(new pair(p.get(0).first , p.get(0).second));
                        b.add(new pair(p.get(2).first , p.get(2).second));
                        c.add(new pair(p.get(1).first , p.get(1).second));
                    }
                    else {
                        a.add(new pair(p.get(0).first , p.get(0).second));
                        b.add(new pair(p.get(2).first , p.get(2).second));
                        c.add(new pair(p.get(1).first , p.get(1).second));

                        a.add(new pair(p.get(0).first , p.get(0).second));
                        b.add(new pair(p.get(3).first , p.get(3).second));
                        c.add(new pair(p.get(1).first , p.get(1).second));

                        a.add(new pair(p.get(0).first , p.get(0).second));
                        b.add(new pair(p.get(2).first , p.get(2).second));
                        c.add(new pair(p.get(3).first , p.get(3).second));

                        a.add(new pair(p.get(3).first , p.get(3).second));
                        b.add(new pair(p.get(2).first , p.get(2).second));
                        c.add(new pair(p.get(1).first , p.get(1).second));
                    }
                    for(int k = 0 ; k < 4 ; ++k) {
                        s[i+left[k]][j+right[k]] = '0';
                    }
                }
            }
            System.out.println(a.size());
            for(int i=0;i<a.size();i++)
            {
                System.out.print((a.get(i).first+1)+" "+(a.get(i).second+1)+" ");
                System.out.print((b.get(i).first+1)+" "+(b.get(i).second+1)+" ");
                System.out.print((c.get(i).first+1)+" "+(c.get(i).second+1)+" ");
                System.out.println();
            }



        }
    }


    static class pair{
        int first;
        int second;
        pair(int first,int second)
        {
            this.first=first;
            this.second=second;
        }

    }
    static class Maths {
        static long gcd(long a, long b) {
            if (a == 0)
                return b;
            return gcd(b % a, a);
        }

        public static long lcm(long a, long b) {
            return (a * b) / gcd(a, b);
        }

        public static long factorial(int n) {
            long fact = 1;
            for (int i = 1; i <= n; i++) {
                fact *= i;
            }
            return fact;
        }
    }



    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}