r = map(int, raw_input().split())
c = map(int, raw_input().split())
d = map(int, raw_input().split())
d.reverse()
a = [[0, 0], [0, 0]]
ansex = True
dd = {}
for i in range(0, 2):
	for j in range(0, 2):
		ansex = ansex and ((r[i] + c[j] - d[(i + j) % 2]) % 2 == 0)
		a[i][j] = (r[i] + c[j] - d[(i + j) % 2]) / 2
		if a[i][j] in dd or a[i][j] < 1 or a[i][j] > 9:
			ansex = False
		else:
			dd[a[i][j]] = 1
ansex = ansex and sum(a[0]) == r[0] and sum(a[1]) == r[1] and a[0][0] + a[1][0] == c[0] and a[0][1] + a[1][1] == c[1] and a[0][0] + a[1][1] == d[1] and a[1][0] + a[0][1] == d[0]
if ansex:
	print a[0][0], a[0][1]
	print a[1][0], a[1][1]
else:
	print -1
