num_lin, num_col = [int(x) for x in input().split()] l, c = [int(x)-1 for x in input().split()] mat = [ [int(x) for x in input().split()] for _ in range(num_lin)] while True: for nl, nc in ( (l-1,c), (l,c+1), (l+1,c), (l,c-1)): if nl in range(num_lin) and nc in range(num_col) and mat[nl][nc] == 1: mat[l][c] = -1 l = nl c = nc caminhei = True break else: break print(l+1, c+1)