
# Problem: A. Help Vasilisa the Wise 2
# Contest: Codeforces - Codeforces Round #102 (Div. 2)
# URL: https://codeforces.com/contest/143/problem/A
# Memory Limit: 256 MB
# Time Limit: 2000 ms
# Powered by CP Editor (https://github.com/cpeditor/cpeditor)

from sys import stdin
def get_ints(): return list(map(int, stdin.readline().strip().split()))

r1,r2 = get_ints()
c1,c2 = get_ints()
d1,d2 = get_ints()

for i in range(1,10):
	for j in range(1,10):
		for k in range(1,10):
			for l in range(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 j!=k and k!=l:
					print(i,j)
					print(k,l)
					exit()
print(-1) 