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

ok = False
for i in range(1,10):
    for j in range(1,10):
        for k in range(1,10):
            for z in range(1,10):
                if not ok and i + j == r1 and k + z == r2 and i + k == c1 and j + z == c2 and i + z == d1 and j + k == d2:
                    if len(set([i,j,k,z])) == 4:
                        ok = True
                        print "%d %d" % (i, j)
                        print "%d %d" % (k, z)

if not ok: print -1

