def solve():
    r1,r2 = list(map(int, str(raw_input()).split()))
    c1,c2 = list(map(int, str(raw_input()).split()))
    d1,d2 = list(map(int, str(raw_input()).split()))
    proper = range(1,10)
    a = (c1+d1-r2)/2
    b = r1-a
    c = c1-a
    d = d1-a
    setter = [a,b,c,d]
    if len(set(setter)) != 4:
        print -1
        return
    for i in [a,b,c,d]:
        if i not in proper:
            print '-1'
            return
    print str(a)+' '+str(b)
    print str(c)+' '+str(d)

solve()
