r1, r2 = map(int, raw_input().split())
c1, c2 = map(int, raw_input().split())
d1, d2 = map(int, raw_input().split())
t = False
for i in range(1, 10):
    for j in range(1, 10):
        for c in range(1, 10):
            for d in range(1, 10):
                if i + j == r1 and i + c == c1 and j+c == d2 and i+d == d1 and c+d == r2:
                    if i != j and i != c and i != d and j != c and j != d \
                            and c != d :
                        t = True
                        print i, j
                        print c, d
if not t:
    print -1
