import sys
sys.setrecursionlimit(1000000000)

#
# Solution Template for Yet Another Lights Problem
# 
# Australian Informatics Olympiad 2023
# 
# This file is provided to assist with reading and writing of the input
# files for the problem. You may modify this file however you wish, or
# you may choose not to use this file at all.
#

# R is the number of rows.
R = None

# C is the number of columns.
C = None

# grid contains the initial state of each light.
grid = []

# Open the input and output files.
input_file = open("yalpin.txt", "r")
output_file = open("yalpout.txt", "w")

# Read the values of R, C and the initial state of each light from the input
# file.
input_line = input_file.readline().strip()
R, C = map(int, input_line.split())
grid = [ input_file.readline().strip() for i in range(R) ]

# TODO: This is where you should compute your solution.

# You should append your cross-flips as tuples into the list cross_flips. For
# example, to include a cross-flip at position (2, 3), you should do
# cross_flips.append((2, 3)).
cross_flips = []

# If it is impossible to turn all the lights on, you should set is_impossible
# to True.
is_impossible = False

# Write the answers to the output file.
if is_impossible:
    output_file.write("-1\n")
else:
    output_file.write("%d\n" % (len(cross_flips)))
    for flip in cross_flips:
        output_file.write("%d %d\n" % (flip[0], flip[1]))

# Finally, close the input/output files.
input_file.close()
output_file.close()