r1, r2 = map(int, raw_input().split())
c1, c2 = map(int, raw_input().split())
d1, d2 = map(int, raw_input().split())
a = (r1 + c1 - d2) / 2
b = (r1 + c2 - d1) / 2
c = (r2 + c1 - d1) / 2
d = (r2 + c2 - d2) / 2
lst = [a, b, c, d]
lst.sort()
s = set(lst)
if len(s) < 4 or lst[0] < 1 or lst[-1] > 9:
    print -1
else:
    print a, b
    print c, d
