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

f = True
for x11 in range(10):
    for x12 in range(10):
        for x21 in range(10):
            for x22 in range(10):
                if x11 + x21 == c1:
                    if x12 + x22 == c2:
                        if x11 + x12 == r1:
                            if x21 + x22 == r2:
                                if x11 + x22 == d1:
                                    if x12 + x21 == d2:
                                        print "%d %d" % (x11, x12)
                                        print "%d %d" % (x21, x22)
                                        f = False

if f:
    print -1