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} 
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 12 17:39:54 2019

@author: Hamadeh
"""

# -*- coding: utf-8 -*-
"""
Created on Fri Jul 12 17:33:49 2019

@author: Hamadeh
"""

class cinn:
    def __init__(self):
        self.x=[]
    def cin(self,t=int):
        if(len(self.x)==0):
            a=input()
            self.x=a.split()
            self.x.reverse()
        return self.get(t)
    def get(self,t):
        return t(self.x.pop())
    def clist(self,n,t=int): #n is number of inputs, t is type to be casted
        l=[0]*n
        for i in range(n):
            l[i]=self.cin(t)
        return l
    def clist2(self,n,t1=int,t2=int,t3=int,tn=2):
        l=[0]*n
        for i in range(n):
            if(tn==2):
                a1=self.cin(t1)
                a2=self.cin(t2)
                l[i]=(a1,a2)
            elif (tn==3):
                a1=self.cin(t1)
                a2=self.cin(t2)
                a3=self.cin(t3)
                l[i]=(a1,a2,a3)
        return l
    def clist3(self,n,t1=int,t2=int,t3=int):
        return self.clist2(self,n,t1,t2,t3,3)
    def cout(self,i,ans=''):   
        if(ans==''):
            print("Case #"+str(i+1)+":", end=' ')
        else:
            print("Case #"+str(i+1)+":",ans)
    def printf(self,thing):
        print(thing,end='')
    def countlist(self,l,s=0,e=None):
        if(e==None):
            e=len(l)
        dic={}
        for el in range(s,e):
            if l[el] not in dic:
                dic[l[el]]=1
            else:
                dic[l[el]]+=1
        return dic
    def talk (self,x):
        print(x,flush=True)
    def dp1(self,k):
        L=[-1]*(k)
        return L
    def dp2(self,k,kk):
        L=[-1]*(k)
        for i in range(k):
            L[i]=[-1]*kk
        return L
    def isprime(self,n):
        if(n==1 or n==0):
            return False
        for i in range(2,int(n**0.5+1)):
            if(n%i==0):
                return False
        return True
    def factors(self,n):    
        from functools import reduce
        return set(reduce(list.__add__, 
                    ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
    def nthprime(self,n):
        #usable up to 10 thousand
        i=0
        s=2
        L=[]
        while(i<n):
            while(not self.isprime(s)):
                s+=1
            L.append(s)
            s+=1
            i+=1
        return L
    def matrixin(self,m,n,t=int):
        L=[]
        for i in range(m):
            p=self.clist(n,t)
            L.append(p)
        return L
    def seive(self,k):
        #1000000 tops
        n=k+1
        L=[True]*n
        L[1]=False
        L[0]=False
        for i in range(2,n):
            if(L[i]==True):
                for j in range(2*i,n,i):
                    L[j]=False
        return L
    def seiven(self,n,L):
        i=0
        for j in range(len(L)):
            if(L[j]==True):
                i+=1
            if(i==n):
                return j
    def matrixin2(self,m,t=int):
        L=[]
        for i in range(m):
            iny=self.cin(str)
            lsmall=[]
            for el in iny:
                lsmall.append(t(el))
            L.append(lsmall)
        return L
def c1(k, x,y,n,m):
    if(x==0 or y==0):
        return False
    else: 
        return (k[x-1][y]==1 and k[x-1][y-1]==1 and k[x][y-1]==1)
def c2(k,x,y,n,m):
    if(x==0 or y==m-1):
        return False
    else:
        return k[x-1][y]==1 and k[x-1][y+1]==1 and k[x][y+1]==1
def c3(k,x,y,n,m):
    if(x==n-1 or y==0):
        return False
    else:
        return k[x+1][y]==1 and k[x+1][y-1]==1 and k[x][y-1]==1
def c4(k, x,y,n,m):
    if(x==n-1 or y==m-1):
        return False
    else: 
        return (k[x+1][y]==1 and k[x+1][y+1]==1 and k[x][y+1]==1)
def tshek(k,x,y,n,m):
    if(c1(k,x,y,n,m)):
        return (x-1,y-1)
    if(c2(k,x,y,n,m)):
        return (x-1, y)
    if(c3(k,x,y,n,m)):
        return (x,y-1)
    if(c4(k,x,y,n,m)):
        return (x,y)
    return False
c=cinn()
n=c.cin()
m=c.cin()
k=c.matrixin(n,m,int)
L=[]
for i in range(n):
    LL=[0]*m
    L.append(LL)
#print(L)
ok=True
final=True
lmoves=[]
for el in range(n):
    for elly in range(m):
        if k[el][elly]==1 and L[el][elly]==0:
            fa=tshek(k,el,elly,n,m)
            if(fa==False):
                final=False
            else:
                lmoves.append(fa)
                L[fa[0]][fa[1]]=1
                L[fa[0]+1][fa[1]]=1
                L[fa[0]][fa[1]+1]=1
                L[fa[0]+1][fa[1]+1]=1
if(final==False):
    print(-1)
else:
    print(len(lmoves))
    for elesh in lmoves:
        print(elesh[0]+1,elesh[1]+1)
        


    

    
    


