A=[map(int,raw_input().split()) for i in range(3)]
r1,r2,r3,r4=[0]*4
for i in range(1,min(A[0][0],10)):
    r1=i
    r2=A[0][0]-r1
    r3=A[1][0]-r1
    r4=A[1][1]-r2
    if r1==r2 or r1==r3 or r1==r4 or r2==r3 or r2==r4 or r3==r4 or r2<=0 or r3<=0 or r4<=0 or r1>=10 or r2>=10 or r3>=10 or r4>=10:
        continue
    if A[2][0]==r1+r4 and A[2][1]==r2+r3 and A[1][0]==r1+r3 and A[1][1]==r2+r4 :
        print r1,r2
        print r3,r4
        exit()
print '-1'
    
