r=list(map(int,raw_input().split()))
r1 = r[0]
r2 = r[1]
c=list(map(int,raw_input().split()))
c1 = c[0]
c2 = c[1]
d=list(map(int,raw_input().split()))
d1 = d[0]
d2 = d[1]

flag = 0
for i in range (1,10):
	for j in range (1,10):
		for k in range (1,10):
				if (i+j==r1 and i+k==c1 and j+k==d2 and i!=j and j!=k):
					print i,j,'\n',k,(r2-k) 
					flag = 1
					break
		if (flag==1):
			break
	if (flag==1):
			break
if (flag==0):
	print '-1'
