# Matheus Oliveira
# 01/08/2017
# 143A.py

rows = map(int, raw_input().split())
columns = map(int, raw_input().split())
diags = map(int, raw_input().split())

possible = False

for n1 in xrange(1, 10):
	possible = True
	
	not_being = [1, 2, 3, 4, 5, 6, 7, 8, 9]
	not_being.remove(n1)
	
	n2 = columns[0] - n1
	
	if n2 in not_being:
		not_being.remove(n2)
	else:
		possible = False
		continue
	
	n3 = rows[0] - n1
	
	if n3 in not_being:
		not_being.remove(n3)
	else:
		possible = False
		continue
	
	n4 = rows[1] - n2
	
	if n4 in not_being:
		not_being.remove(n4)
	else:
		possible = False
		continue
		
	if rows[0] != n1 + n3 or rows[1] != n2 + n4 or columns[0] != n1 + n2:
		possible = False
	if columns[1] != n3 + n4 or diags[0] != n1 + n4 or diags[1] != n3 + n2:
		possible = False
	
	if possible:
		print n1, n3
		print n2, n4
		break

if not possible:
	print '-1'
