R = map(int, raw_input().strip().split())
C = map(int, raw_input().strip().split())
D = map(int, raw_input().strip().split())

ans = []

for i in range(1, 10):
    for j in range(1, 10):
        for k in range(1, 10):
            for l in range(1, 10):
                if not j in [i] and not k in [i, j] and not l in [i, j, k] and i + j == R[0] and k + l == R[1] and i + k == C[0] and j + l == C[1] and i + l == D[0] and j + k == D[1]:
                    ans = [i, j, k, l]

if ans == []:
    print '-1'
else:
    print str(ans[0]) + ' ' + str(ans[1])
    print str(ans[2]) + ' ' + str(ans[3])
