I = lambda: map(int, input().split())

r1, r2 = I()
c1, c2 = I()
d1, d2 = I()

for a in range(1, 10):
    b, c, d = r1-a, c1-a, d1-a
    if b<=0 or c<=0 or d<=0 or b+d!=c2 or c+d!=r2 or b+c!=d2 or len({a,b,c,d})<4:
        continue
    print(a, b)
    print(c, d)
    break
else:
    print(-1)