while True: try: m, n = map(int, input().split()) x1, y1, x2, y2 = map(int, input().split()) xAdd = int(input()) yAdd = int(input()) xChk, yChk = map(int, input().split()) print(0 if m <= 9 and n <= 9 else -1) print(0 if x1 < m an...