def solve():
    r1,r2 = map(int, raw_input().split())
    c1,c2 = map(int, raw_input().split())
    d1,d2 = map(int, raw_input().split())
    for e1 in range(1, 10):
        for e2 in range(1, 10):
            for e3 in range(1, 10):
                for e4 in range(1, 10):
                    if e1+e2 == r1 and e3+e4 == r2 and e1+e3 == c1 and e2+e4 == c2 and e1+e4 == d1 and e2+e3 == d2:
                        return (e1,e2,e3,e4)

    return (-1,-1,-1,-1)
res = solve()

if len(set(res)) == 1:
    print -1
else:
    print res[0],res[1]
    print res[2],res[3]