import sys

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

for a in xrange(1,10):
    for b in xrange(1,10):
        for c in xrange(1,10):
            for d in xrange(1,10):
                if r1==a+b and r2==c+d and c1==a+c and c2==b+d and d1==a+d and d2==b+c:
                    print a,b
                    print c,d
                    sys.exit()

print "-1"
