r1,r2=map(int,raw_input().split())
c1,c2=map(int,raw_input().split())
d1,d2=map(int,raw_input().split())
a=(r1-c2+d1)/2
b=(c2+r1-d1)/2
c=(c1+r2-d1)/2
d=(c2-r1+d1)/2
F=[0]*10
if(a<10 and a>=0 and b<10 and b>=0 and c<10 and c>=0 and d<10 and d>=0):
	F[a]+=1
	F[b]+=1
	F[c]+=1
	F[d]+=1
	flag=True
	for x in F:
		if(x>1):
			flag=False
			break
	if(flag):
		if(a+b==r1 and c+d==r2 and a+c==c1 and b+d==c2 and a+d==d1 and b+c==d2):
			print a,b
			print c,d
		else:
			print "-1"
	else:
		print "-1"
else:
	print "-1"
