L = lambda: map(int,raw_input().split())
r1,r2 = L(); c1,c2 = L(); d1,d2 = L()

x = (r1-c1+d2)/2
w = r1 - x
y = d2 - x
z = c2 - x

if any(i<0 or i>10 for i in (w,x,y,z)) or len(set([w,x,y,z])) < 4:
    print -1
else:
    print w,x,"\n",y,z