You are given two matrices A and B. Each matrix contains exactly n rows and m columns. Each element of A is either 0 or 1; each element of B is initially 0.

You may perform some operations with matrix B. During each operation, you choose any submatrix of B having size 2 × 2, and replace every element in the chosen submatrix with 1. In other words, you choose two integers x and y such that 1 ≤ x < n and 1 ≤ y < m, and then set B_{x, y}, B_{x, y + 1}, B_{x + 1, y} and B_{x + 1, y + 1} to 1.

Your goal is to make matrix B equal to matrix A. Two matrices A and B are equal if and only if every element of matrix A is equal to the corresponding element of matrix B.

Is it possible to make these matrices equal? If it is, you have to come up with a sequence of operations that makes B equal to A. Note that you don't have to minimize the number of operations.

Input

The first line contains two integers n and m (2 ≤ n, m ≤ 50).

Then n lines follow, each containing m integers. The j-th integer in the i-th line is A_{i, j}. Each integer is either 0 or 1.

Output

If it is impossible to make B equal to A, print one integer -1.

Otherwise, print any sequence of operations that transforms B into A in the following format: the first line should contain one integer k — the number of operations, and then k lines should follow, each line containing two integers x and y for the corresponding operation (set B_{x, y}, B_{x, y + 1}, B_{x + 1, y} and B_{x + 1, y + 1} to 1). The condition 0 ≤ k ≤ 2500 should hold.

Examples

Input


3 3
1 1 1
1 1 1
0 1 1


Output


3
1 1
1 2
2 2


Input


3 3
1 0 1
1 0 1
0 0 0


Output


-1


Input


3 2
0 0
0 0
0 0


Output


0

Note

The sequence of operations in the first example:

\begin{matrix} 0 & 0 & 0 & & 1 & 1 & 0 & & 1 & 1 & 1 & & 1 & 1 & 1 \\\ 0 & 0 & 0 & → & 1 & 1 & 0 & → & 1 & 1 & 1 & → & 1 & 1 & 1 \\\ 0 & 0 & 0 & & 0 & 0 & 0 & & 0 & 0 & 0 & & 0 & 1 & 1 \end{matrix} 
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
import java.util.Map.*;
public class codeforces {
     static int [] [] A,B;
	static 	PrintWriter pw=new PrintWriter(System.out);
	static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
	int count =0;
	public static boolean check(int x,int y) {
		return A[x][y]==1 && A[x][y+1]==1 && A[x+1][y]==1 && A[x+1][y+1]==1;
	}
	public static void fill(int x,int y) {
		B[x][y]=1 ; B[x][y+1]=1 ; B[x+1][y]=1 ; B[x+1][y+1]=1;
	}
	public static boolean compare(int x,int y) {
		for(int i=0;i<x;i++)
			for(int j=0;j<y;j++) if(A[i][j]!=B[i][j]) return false;
		return true;
	}
	public static void main(String [] args) throws IOException, InterruptedException {
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt(); int y=sc.nextInt();
		 A=new int [x][y];
		 B=new int [x][y];
		for(int i=0;i<x;i++) A[i]=sc.nextIntArray(y);
		ArrayList<pair> list=new ArrayList<>();
		for(int i=0;i<x-1;i++) {
			for(int j=0;j<y-1;j++) {
				if(check(i, j)) {list.add(new pair(i+1, j+1)); fill(i, j);}
			}
		}
		if(compare(x, y)) {
			pw.println(list.size());
			for(pair z:list) pw.println(z);
		}else pw.print(-1);
		pw.flush();
		pw.close();
	}
	static class pair implements Comparable<pair>{
		int x, y;
		public pair(int x,int y) {this.x=x; this.y=y;}
		public int compareTo(pair p) {
			return x-p.x;
		}
		public String toString() {return x+" "+y;}
	}
	   static class Scanner {
			StringTokenizer st;
			BufferedReader br;
	 
			public Scanner(InputStream system) {
				br = new BufferedReader(new InputStreamReader(system));
			}
	 
			public Scanner(String file) throws Exception {
				br = new BufferedReader(new FileReader(file));
			}
	 
			public String next() throws IOException {
				while (st == null || !st.hasMoreTokens())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			}
			public String nextLine() throws IOException {
				return br.readLine();
			}
	 
			public int nextInt() throws IOException {
				return Integer.parseInt(next());
			}
	 
			public double nextDouble() throws IOException {
				String x = next();
				StringBuilder sb = new StringBuilder("0");
				double res = 0, f = 1;
				boolean dec = false, neg = false;
				int start = 0;
				if (x.charAt(0) == '-') {
					neg = true;
					start++;
				}
				for (int i = start; i < x.length(); i++)
					if (x.charAt(i) == '.') {
						res = Long.parseLong(sb.toString());
						sb = new StringBuilder("0");
						dec = true;
					} else {
						sb.append(x.charAt(i));
						if (dec)
							f *= 10;
					}
				res += Long.parseLong(sb.toString()) / f;
				return res * (neg ? -1 : 1);
			}
	 
			public char nextChar() throws IOException {
				return next().charAt(0);
			}
	 
			public Long nextLong() throws IOException {
				return Long.parseLong(next());
			}
	 
			public boolean ready() throws IOException {
				return br.ready();
			}
			public int[] nextIntArray(int n) throws IOException {
	            int[] a = new int[n];
	            for (int i = 0; i < n; i++)
	                a[i] = nextInt();
	            return a;
	        }
	        public long[] nextLongArray(int n) throws IOException {
	            long[] a = new long[n];
	            for (int i = 0; i < n; i++)
	                a[i] = nextLong();
	            return a;
	        }
	        public HashMap<Integer, Integer> nextHashMap(int n) throws IOException{
	        	HashMap<Integer, Integer> map =new HashMap<>();
	        	for(int i=0;i<n;i++) {
	        		int x=nextInt();
	        		int b=map.getOrDefault(x, 0);
	        		map.put(x, b+1);
	        	}
	        	return map;
	        }
	        public TreeMap<Integer, Integer> nextTreeMap(int n) throws IOException{
	        	TreeMap<Integer, Integer> map =new TreeMap<>();
	        	for(int i=0;i<n;i++) {
	        		int x=nextInt();
	        		int b=map.getOrDefault(x, 0);
	        		map.put(x, b+1);
	        	}
	        	return map;
	        }
	        public HashSet<Integer> nextHashSet (int n) throws IOException{
	        	HashSet<Integer> set=new HashSet<>();
	        	for(int i=0;i<n;i++) set.add(nextInt());
	        	return set;
	        }
	        public long[] nextLongArraySorted(int n) throws IOException {
	        	long [] arr=nextLongArray(n);
	        	Arrays.parallelSort(arr);
	            return arr;
	        }
	        public int [] nextIntArraySorted(int n) throws IOException{
	        	int [] arr=nextIntArray(n);
	        	Arrays.parallelSort(arr);
	        	return arr;
	        }
		    public void waitForInput() throws InterruptedException {
				Thread.sleep(3000);
			}
		}

	}