import itertools

r = [int(j) for j in raw_input().split()]
c = [int(j) for j in raw_input().split()]
d = [int(j) for j in raw_input().split()]

lock = [[0,0], [0,0]]

def genLocks():
    for p in itertools.permutations(range(1,10),4):
        if (r[0]==p[0]+p[1] and r[1]==p[2]+p[3] and
            c[0]==p[0]+p[2] and c[1]==p[1]+p[3] and
            d[0]==p[0]+p[3] and d[1]==p[1]+p[2] 
            ):
            p = [str(j) for j in p]
            return '\n'.join((' '.join(p[:2]), ' '.join(p[2:])))
    return -1

print genLocks()
