'''
这道题是阅读理解题,没多大难度,考验读题耐心
'''
while True:
try:
m, n = list(map(int,input().split( )))
x1, y1, x2, y2 = list(map(int, input().split( )))
insert_x = int(input())
insert_y = int(input())
x, y = list(map(int, input().split()))
if 0 <= m < 10 and 0 <= n < 10:
print(0)
else:
print(-1)
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)
if 0 <= insert_x <= m-1 and m <= 8:
print(0)
else:
print(-1)
if 0 <= insert_y <= n-1 and n <= 8:
print(0)
else:
print(-1)
if 0 <= x <=m-1 and 0 <= y <= n-1:
print(0)
else:
print(-1)
except:
break
这道题是阅读理解题,没多大难度,考验读题耐心
'''
while True:
try:
m, n = list(map(int,input().split( )))
x1, y1, x2, y2 = list(map(int, input().split( )))
insert_x = int(input())
insert_y = int(input())
x, y = list(map(int, input().split()))
if 0 <= m < 10 and 0 <= n < 10:
print(0)
else:
print(-1)
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)
if 0 <= insert_x <= m-1 and m <= 8:
print(0)
else:
print(-1)
if 0 <= insert_y <= n-1 and n <= 8:
print(0)
else:
print(-1)
if 0 <= x <=m-1 and 0 <= y <= n-1:
print(0)
else:
print(-1)
except:
break