r1, r2 = map(int, raw_input().split())
c1, c2 = map(int, raw_input().split())
d1, d2 = map(int, raw_input().split())
c = (c1 + d2 - r1) / 2
a = c1 - c
b = d2 - c
d = r2 - c
if (r1 + r2) != (c1 + c2) or (r1 + r2) != (d1 + d2) or a == b or c == d or max(a, b, c, d) > 9:
    print - 1
else:
    print a, b
    print c, d