l=lambda:map(int,raw_input().split())
r,R=l()
c,C=l()
d,D=l()
y=r-c+D
if y%2:
    print -1
else:
    y=y/2
    x=r-y
    k=C-y
    z=R-k

    if (x+k==d and z+y==D and  len(set(range(1,10))&set([x,y,z,k]))==4):
        print x,y,"\n",z,k
    else:
        print -1
        