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

import itertools
for p in itertools.permutations(range(1, 10), 4):
    if p[0] + p[1] == r1 and p[2] + p[3] == r2 and p[0] + p[2] == c1 and p[1] + p[3] == c2 and p[0] + p[3] == d1 and p[1] + p[2] == d2:
        print p[0], p[1]
        print p[2], p[3]
        quit()
print -1
