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

n1 = n2 = n3 = n4 = None

def magix():
    for n1 in range(1,10):
        for n2 in range(1,10):
            if n2 == n1:
                continue
            for n3 in range(1,10):
                if n3 in [n1,n2]:
                    continue
                for n4 in range(1,10):
                    if n4 in [n1,n2,n3]:
                        continue
                    row1 = n1+n2
                    row2 = n3+n4
                    col1 = n1+n3
                    col2 = n2+n4
                    diag1 = n1+n4
                    diag2 = n2+n3

                    if row1 == r1 and row2 == r2 and col1 == c1 and col2 == c2 and diag1 == d1 and diag2 == d2:
                        return n1,n2,n3,n4
    return -1,-1,-1,-1

output = magix()
if output[0] == -1:
    print -1
else:
    print "%s %s"%(output[0],output[1])
    print "%s %s"%(output[2],output[3])