r1 , r2 = map(int,input().split())
c1 , c2 = map(int,input().split())
d1 , d2 = map(int,input().split())
ans = [[0,0],[0,0]]
cond = False
cnt = 1
while (1):
	ans[0][0] = cnt
	ans[0][1] = r1 - ans[0][0]
	ans[1][0] = c1 - ans[0][0]
	ans[1][1] = r2 - ans[1][0]
	if cnt>9:
		prnt = -1
		break
	if (ans[0][1]<=0 or ans[1][0]<=0 or ans[1][1]<=0) or (ans[0][1]+ans[1][1]!=c2) or (ans[0][0]+ans[1][1]!=d1 or ans[0][1]+ans[1][0]!=d2):
		ans = [[0,0],[0,0]]
		cnt+=1
		if (r1 == 1 or r2 == 1) or (c1 == 1 or c2 == 1) or (d1 == 1 or d2 == 1):
			prnt = -1
			break
	elif (c1 == r1 or c1 == r2) or (c2 == r1 or c2 == r2):
		prnt = -1
		break
	elif  (ans[0][0]==10 or ans[0][1]==10) or (ans[1][0]==10 or ans[1][1]==10):
		prnt = -1
		break
	else:
		prnt = ans
		break

if prnt==-1:
	print(-1)
else:
	for i in range(2):
		print(prnt[i][0],prnt[i][1])