读懂题目就不难
while True: try: m,n = map(int, input().split())#行、列 e_row1,e_list1,e_row2,e_list2 = map(int, input().split())#交换的行列坐标 insert_row = int(input())#插入的行 insert_list = int(input())#插入的列 v_row,v_list = map(int, input().split())#查询的坐标 if m <=9 and m >= 0 and n <= 9 and n >= 0: print(0) else: print(-1) if e_row1 <= m-1 and e_list1 <= n-1 and e_row2 <= m-1 and e_list2 <= n-1: print(0) else: print(-1) if insert_row <= m-1 and m < 9: print(0) else: print(-1) if insert_list <= n-1 and n < 9: print(0) else: print(-1) if v_row <= m - 1 and v_list <= n - 1: print(0) else: print(-1) except: break