def main():
	r1, r2 = map(int, raw_input().split())
	c1, c2 = map(int, raw_input().split())
	d1, d2 = map(int, raw_input().split())
	if (r1 - c1 + d2) % 2 != 0 or (c1 - r2 + d1) % 2 != 0:
		print -1
		return
	else:
		a, d = (c1 - r2 + d1) / 2, (d1 - c1 + r2) / 2
		b, c = (r1 - c1 + d2) / 2, (d2 - r1 + c1) / 2
		if 1 <= a <= 9 and 1 <= b <= 9 and 1 <= c <= 9 and 1 <= d <= 9 and \
			a + b == r1 and c + d == r2 and a + c == c1 and b + d == c2 and \
			b + c == d2 and a + d == d1 and 4 == len(set((a, b, c, d))):
			print a, b
			print c, d
		else: print -1 

if __name__ == "__main__": main()