注意题目要求:所有输入坐标范围0m-1和0n-1:

while True:
    try:
        m, n = map(int, input().split())
        if 0 <= m <= 9 and 0 <= n <= 9:
            print(0)
        else:
            print(-1)
        
        x1, y1, x2, y2 = map(int, input().split())
        if 0 <= x1 <= m - 1 and 0 <= x2 <= m - 1 and 0 <= y1 <= n - 1 and 0 <= y2 <= n - 1:
            print(0)
        else:
            print(-1)
        
        x = int(input())
        if 0 <= x <= m - 1 and m + 1 <= 9:
            print(0)
        else:
            print(-1)
        y = int(input())
        if 0 <= y <= n - 1 and n + 1 <= 9:
            print(0)
        else:
            print(-1)
        x, y = map(int, input().split())
        if 0 <= x <= 9 and 0 <= y <= 9 and 0 <= x <= m -1 and 0 <= y <= n -1:
            print(0)
        else:
            print(-1)
    except:
        break