import sys
r1, r2 = map(int, sys.stdin.readline().split())
c1, c2 = map(int, sys.stdin.readline().split())
d1, d2 = map(int, sys.stdin.readline().split())
for a in range(1,10):
    for b in range(1,10):
        for c in range(1,10):
            for d in range(1,10):
                if a+b == r1 and a+c == c1 and a+d == d1 \
                         and b+c == d2 and b+d == c2 \
                         and c+d == r2 \
                         and len(set([a,b,c,d])) == 4:
                    print a,b
                    print c,d
                    sys.exit()
print -1
