k=[]
for i in range(3):
    k.append(list(map(int,input().split())))
r1,r2,c1,c2,d1,d2=k[0][0],k[0][1],k[1][0],k[1][1],k[2][0],k[2][1]
x1=(r1-d2+c1)//2
x2=r1-x1
x3=(d2-r1+c1)//2
x4=d1-x1
if x1<0 or x2<0 or x3<0 or x4<0 or x1==x2 or x3==x4 or x1>9 or x2>9 or x3>9 or x4>9 or x1==x3 or x1==x4 or x2==x3 or x2==x4:print(-1)
else:
    print(x1,x2)
    print(x3,x4)

