i1 = input()
i1 = i1.split(' ')
r1 = int(i1[0])
r2 = int(i1[1])
i2 = input()
i2 = i2.split(' ')
c1 = int(i2[0])
c2 = int(i2[1])
i3 = input()
i3 = i3.split(' ')
d1 = int(i3[0])
d2 = int(i3[1])
one = int(((r1 + c1 ) - d2 ) / 2)
two = int(r1 - one)
three = int(c1 - one)
four = int(d1 - one)
if one != two and one != three and one!= four and two != three and two != four and  c1 +c2 == r1 + r2 and c1 + c2 == d1 + d2 and three != four and one <10 and two <10 and three <10 and four <10 and one >0 and two >0 and three >0 and four > 0 :
    print(str(one) + ' ' + str(two))
    print(str(three) + ' ' + str(four))
else :
    print(-1)
