r1, r2 = map(int, raw_input().split())
c1, c2 = map(int, raw_input().split())
d1, d2 = map(int, raw_input().split())
res = "-1"
for x in xrange(1, 10):
	for y in xrange(1, 10):
		for z in xrange(1, 10):
			for t in xrange(1, 10):
				if not ((x == y) or (x == z) or ( x== t)):
					if not ((y == z) or (y == t) or ( z == t)):
						if (x + y == r1) and (z + t == r2):
							if (x + z == c1) and (y + t == c2):
								if (x + t == d1) and (y + z == d2):
									res = str(x) + " " + str(y) + "\n"
									res +=  str(z) + " " + str(t) + "\n"
print res
							
