r1,r2=map(int,input().strip().split())
c1,c2=map(int,input().strip().split())
d1,d2=map(int,input().strip().split())
a=(r1-d2+c1)//2
flag=0
b=c1-a
c=r1-a
d=r2-b
l=[a,b,c,d]
s=set(l)
if len(l)==len(s):
    if 1<=a<=9 and 1<=b<=9 and 1<=c<=9 and 1<=d<=9:
        print(a,c,sep=" ")
        print(b,d,sep=" ")
        flag=1
    else:
        print(-1)
        flag=1
if flag==0:
    print(-1)