r1,r2=map(int,raw_input().split())
c1,c2=map(int,raw_input().split())
d1,d2=map(int,raw_input().split())
f=0
for i in range(1,10):
        for j in range(1,10):
                for k in range(1,10):
                        for l  in range(1,10):
                                if(i+j==c1 and i+k==r1 and j+l==r2 and k+l==c2 and i+l==d1 and j+k==d2):
                                        print i,k
                                        print j,l
                                        f=1
                                        break
if f==0:
        print -1
