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)
flag=0
b=c1-a
c=r1-a
d=r2-b
l=[a,b,c,d]
s=set(l)
if a%2==0:
    a=a//2
    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=" ")
            
        else:
            print(-1)
    else:
        print(-1)
else:
    print(-1)
