r1, r2 = map(int, raw_input().split())
c1, c2 = map(int, raw_input().split())
d1, d2 = map(int, raw_input().split())
for a in range(10):
	b = r1 - a
	c = c1 - a
	d = c2 - r1 + a
	if c + d == r2 and a + d == d1 and b + c == d2 and len(set([a, b, c, d]) & set(range(1, 10))) == 4:
		print a, b, '\n', c, d
		quit()
print -1