data = []
for i in range(3):
    data += map(int, raw_input().split())
[r1,r2,c1,c2,d1,d2] = data
if (r1+r2) == (c1+c2) == (d1+d2):
    a = (r1+c1-d2)/2.0
    b = r1 - a
    c = c1 - a
    d = d1 - a
    if (a-b)*(b-c)*(c-d)*(d-a) and (10-a)>0 and (10-b)>0 and (10-c)>0 and (10-d)>0 and not(a+b+c+d-int(a)-int(b)-int(c)-int(d)):
        print("%d %d\n%d %d" %(a,b,c,d))
    else:
        print("-1")
else:
    print("-1")
