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
b=(r1+d2-c1)/2
c=(d2+c1-r1)/2
d=(2*r2-d2-c1+r1)/2
if (a==round(a) and 1<=a<=9) and (b==round(b) and 1<=b<=9) and (c==round(c) and 1<=c<=9) and (d==round(d) and 1<=d<=9) and(a!=b!=c!=d):
    print(round(a),round(b),sep=" ")
    print(round(c),round(d),end=" ")
else:
    print(-1)
