r1, r2 = map(int, raw_input().split())
c1, c2 = map(int, raw_input().split())
d1, d2 = map(int, raw_input().split())
found = False
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 found:
					break
				if i!=j and i!=k and i!=l and j!=k and j!=l and k!=l:
					if i+j == r1 and k+l == r2:
						if i+k == c1 and j + l == c2:
							if i+l == d1 and j + k == d2:
								found = True
								print str(i) + " " + str(j)
								print str(k) + " " + str(l)
if not found:
	print -1
