from itertools import permutations
E=[4,3,2,1]
def f():
    for i in range(len(E)):
        if E[i] < 9 :
            E[i]+=1
            if E[i]+i >= 10:
                continue
            c=1
            for j in range(i-1,-1,-1):
                E[j]=E[i]+c
                c+=1
            break
            
           
A=[ map(int,raw_input().split()) for i in range(3) ]
C=[9,8,7,6]

while E != C:
    t=permutations(E)
    for B in t:
        if B[0]+B[1] == A[0][0] and B[2]+B[3] == A[0][1] and  B[0]+B[2]==A[1][0] and B[1]+B[3]==A[1][1] and B[0]+B[3]==A[2][0] and B[1]+B[2]==A[2][1]:
            print B[0],B[1]
            print B[2],B[3]
            exit()
    f()
t=permutations(E)
for B in t:
    if B[0]+B[1] == A[0][0] and B[2]+B[3] == A[0][1] and  B[0]+B[2]==A[1][0] and B[1]+B[3]==A[1][1] and B[0]+B[3]==A[2][0] and B[1]+B[2]==A[2][1]:
        print B[0],B[1]
        print B[2],B[3]
        exit()
print '-1'
