f = lambda:map(int,raw_input().split())
(r1,r2),(c1,c2),(d1,d2) = [f() for _ in range(3)]
a = (r1+c1-d2)/2
b = r1 - a
c = c1 - a
d = c2 - b
if len(set([a,b,c,d]))==4 and all(i in range(1,10) for i in [a,b,c,d]) and c2==b+d and d1==a+d and d2==b+c:
    print a,b
    print c,d
else:
    print -1
