Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
As = [list(map(int, input().split())) for _ in range(H)]

before_A = None
history = []
for h, row in enumerate(As):
    it = enumerate(row)
    if h % 2 == 0:
        it = reversed(list(it))
    for w, A in enumerate(row):
        if A % 2 == 0:
            if before_A is not None:
                path.append(h, w)

        else:
            if before_A is None:
                before_A = (h, w)
                path = [(h, w)]
            else:
                path.append((h, w))
                history.append(path[:])
                before_A = None

ans = []
for path in history:
    for i in range(len(path) - 1):
        ans.append( (path[i], path[i+1]) )

print(len(ans))
for (a, b), (c, d) in ans:
    print(a+1, b+1, c+1, d+1, sep = ' ')


    

Fixed submission:
H, W = map(int, input().split())
As = [list(map(int, input().split())) for _ in range(H)]

before_A = None
history = []
for h, row in enumerate(As):
    it = enumerate(row)
    if h % 2 == 0:
        it = reversed(list(it))
    for w, A in it:
        if A % 2 == 0:
            if before_A is not None:
                path.append((h, w))

        else:
            if before_A is None:
                before_A = (h, w)
                path = [(h, w)]
            else:
                path.append((h, w))
                history.append(path[:])
                before_A = None

ans = []
for path in history:
    for i in range(len(path) - 1):
        ans.append( (path[i], path[i+1]) )

print(len(ans))
for (a, b), (c, d) in ans:
    print(a+1, b+1, c+1, d+1, sep = ' ')

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
As = [list(map(int, input().split())) for _ in range(H)]

before_A = None
history = []
for h, row in enumerate(As):
    it = enumerate(row)
    if h % 2 == 0:
        it = reversed(list(it))
    for w, A in enumerate(row):
        if A % 2 == 0:
            if before_A is not None:
                path.append(h, w)

        else:
            if before_A is None:
                before_A = (h, w)
                path = [(h, w)]
            else:
                path.append((h, w))
                history.append(path[:])
                before_A = None

ans = []
for path in history:
    for i in range(len(path) - 1):
        ans.append( (*path[i], *path[i+1]) )

print(len(ans))
for a, b, c, d in ans:
    print(a+1, b+1, c+1, d+1, sep = ' ')


    


Fixed submission:
H, W = map(int, input().split())
As = [list(map(int, input().split())) for _ in range(H)]

before_A = None
history = []
for h, row in enumerate(As):
    it = enumerate(row)
    if h % 2 == 0:
        it = reversed(list(it))
    for w, A in it:
        if A % 2 == 0:
            if before_A is not None:
                path.append((h, w))

        else:
            if before_A is None:
                before_A = (h, w)
                path = [(h, w)]
            else:
                path.append((h, w))
                history.append(path[:])
                before_A = None

ans = []
for path in history:
    for i in range(len(path) - 1):
        ans.append( (path[i], path[i+1]) )

print(len(ans))
for (a, b), (c, d) in ans:
    print(a+1, b+1, c+1, d+1, sep = ' ')