A=[map(int,raw_input().split()) for i in range(3)]
for i in range(1,min(A[0][0],10)):
    a=i
    b=A[0][0]-a
    c=A[1][0]-a
    d=A[1][1]-b
    if a==b or a==c or a==d or b==c or b==d or c==d:
        continue
    if 0<a<10 and 0<b<10 and 0<c<10 and 0<d<10 and A[2][0]==a+d and A[2][1]==b+c and A[0][1]==c+d :
        print a,b
        print c,d
        exit()
print '-1'
    
