r1,r2=map(int,raw_input().split(" "))
c1,c2=map(int,raw_input().split(" "))
d1,d2=map(int,raw_input().split(" "))
#
no=[1,19,20]
yes=range(1,10)
if r1 in no or r2 in no or c1 in no or c2 in no or d1 in no or d2 in no:
    print -1
else:
    if r1+r2==c1+c2==d1+d2 and r1!=c2 and r1!=d2 and r2!=d1 and r2!=c1 and c1!=d2 and c2!=d1:
        a=(r1+d1-c2)/2
        b=r1-a
        c=(r2+c1-d1)/2
        d=r2-c
        if a in yes and b in yes and c in yes and d in yes:
            print a,b
            print c,d
        else:
            print -1
    else:
        print -1