r1,r2 = [int(x) for x in raw_input().split(" ")]
c1,c2 = [int(x) for x in raw_input().split(" ")]
d1,d2 = [int(x) for x in raw_input().split(" ")]
p = 1
q = 9
for a in range(p,q+1):
	for b in range(p,q+1):
		if (a+b) == r1: 
			for c in range(p,q+1):
				if (a+c) == c1:
					if (b+c) == d2:
						for d in range(p,q+1):
							if (a+d) == d1:
								if (b+d) == c2:
									if (c+d) == r2:
										print a,b
										print c,d
										exit()
print -1