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