h,w = map(int, input().split())

#start位置を受け取り
def bfs(width, height ,ar):
  print(width,height)

#main処理
ar = []
for i in range(h):
  ar.append(list(input()))
print(ar)

for width in range(w):
  for height in range(h):
    bfs(width, height, ar)
