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.0
b = (r1 + c2 - d1) / 2.0
c = (r2 + c1 - d1) / 2.0
d = (r2 + c2 - d2) / 2.0

lst = [a, b, c, d]
lsti = [int(i) for i in lst]
if lst != lsti:
    print -1
    exit()

lst.sort()
if lst[0] < 1 or lst[-1] > 9:
    print -1
    exit()

s = set(lst)
if len(s) < 4:
    print -1
    exit()

print lsti[0], lsti[1]
print lsti[2], lsti[3]
