n = int(input())
m = int(input())
ee = []
qq = 0
wx = 0
eexx = []
s = n
for i in range(n):
    ww = input()
    xx = ww
    xx.join('')
    ee.append(list(xx))
    
for i in range(s,0):
    for j in range(s,0):
        if '0' in ee[j]:
            qq = j
            wx = i
            eexx.append(qq)
            eexx.append(wx)
            s -= 1
            break
print(eexx)