r1, r2 = map(int, raw_input().split())
c1, c2 = map(int, raw_input().split())
d1, d2 = map(int, raw_input().split())

x = (c1-r2+d1) // 2
y = (c2-r2+d2) // 2
z = (c1-r1+d2) // 2
m = (r1+r2+c1+c2+d1+d2) // 3 - (x+y+z)

#print x, y, z, m
if len(set([x, y, z, m])) != 4 or max([x, y, z, m]) > 9 or min([x, y, z, m]) < 0 or (r1+r2+c1+c2+d1+d2) % 3 != 0:
    print -1
else:
    print "%d %d" % (x, y)
    print "%d %d" % (z, m)
