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


ans = []
for i in xrange(1, 10):
    for j in xrange(1, 10):
        if i == j:
            continue
        for k in xrange(1, 10):
            if k == i or k == j:
                continue
            for l in xrange(1, 10):
                if l == i or l == j or l == k:
                    continue

                if i + j != r1 or k + l != r2 \
                or i + l != d1 or j + k != d2 \
                or i + k != c1 or j + l != c2:
                    continue

                ans = [i, j, k, l]

if len(ans):
    print ans[0], ans[1]
    print ans[2], ans[3]
else:
    print -1
                
