#coding: utf-8

r1r2 = raw_input().split()
c1c2 = raw_input().split()
d1d2 = raw_input().split()
r1 = int(r1r2[0])
r2 = int(r1r2[1])
c1 = int(c1c2[0])
c2 = int(c1c2[1])
d1 = int(d1d2[0])
d2 = int(d1d2[1])
if(d1+d2 == c1+c2 and r1+r2 == d1+d2):
	n1 = 0
	n2 = 0
	n3 = 0
	n4 = 0
	for i in xrange(1,10):
		for j in xrange(1,10):
			for k in xrange(1,10):
				for l in xrange(1,10):
					if(i+j == r1 and k+l == r2 and i+k==c1 and j+l==c2 and i+l==d1 and j+k==d2 and i!=j and i!=k and i!=l and j!=k and j!=l and k!=l):
						n1=i
						n2=j
						n3=k
						n4=l
	if(n1!=n2):
		print '%i %i' % (n1,n2)					
		print '%i %i' % (n3,n4)	
	else:
		print '-1'				
else:
	print '-1'	 
