r1, r2 = map(int, raw_input().split())
c1, c2 = map(int, raw_input().split())
d1, d2 = map(int, raw_input().split())

M = [[0, 0], [0, 0]]
ind = False
i = 1

while i < 10 and not ind:
    M[0][0] = i
    M[0][1] = r1 - i
    M[1][0] = c1 - i
    M[1][1] = d1 - i
    if M[0][0] != M[0][1] and M[0][0] != M[1][0] and M[0][0] != M[1][1] and M[0][1] != M[1][0] and M[0][1] != M[1][1] and M[1][0] != M[1][1]:
        if r2 == M[1][0] + M[1][1] and c2 == M[0][1] + M[1][1] and d2 == M[0][1] + M[1][0]:
            if 0 < M[0][0] < 10 and 0 < M[0][1] < 10 and 0 < M[1][0] < 10 and 0 < M[1][1] < 10:
                print M[0][0], M[0][1]
                print M[1][0], M[1][1]
                ind = True
    i += 1

if not ind:
    print -1
    