#!/usr/bin/python
# -*- coding: utf-8 -*-

##################################
# Codeforces Round #102 (Div.2)  #
##################################

from sys import stdin, stdout, stderr

def unlock(r1, r2, c1, c2, d1, d2):
	"""
	INPUT::
	Four integers 1<= r1, r2, c1, c2, d1, d2 <= 20

	OUTPUT::
	If there is answer "unlock" returns pair of integer pair in a form ((m1, m2), (m3, m4));
	otherwise "unlock" returns (). Note 1 <= m1, m2, m3, m4 <= 9.
	which satisties following equations:
	r1 == m1 + m2, r2 == m3 + m4
	c1 == m1 + m3, c2 == m2 + m4
	d1 == m1 + m4, d2 == m2 + m3
	
	EXAMPLE::
	>>> unlock(3, 7, 4, 6, 5, 5)
	((1, 2), (3, 4))
	>>> unlock(11, 10, 13, 8, 5, 16)
	((4, 7), (9, 1))
	>>> unlock(1, 2, 3, 4, 5, 6)
	()
	>>> unlock(10, 10, 10, 10, 10, 10)
	()
	>>> unlock(12, 17, 10, 19, 13, 16)
	()
	"""
	for m1 in range(1, 10):
		# substitute by left side equations above
		m2 = r1 - m1
		m3 = c1 - m1
		m4 = d1 - m1
		# check in proper range AND right side equations AND disjoint
		if all([
			m2 in range(1, 10),
			m3 in range(1, 10),
			m4 in range(1, 10),
			r2 == m3 + m4, 
			c2 == m2 + m4, 
			d2 == m2 + m3, 
			len(set([m1, m2, m3, m4])) == 4]): return ((m1, m2), (m3, m4))
	# if no answer exists
	return () 
		

if __name__ == "__main__":
	from doctest import testmod
	testmod()	
	r1, r2 = map(int, stdin.readline().split(" "))
	c1, c2 = map(int, stdin.readline().split(" "))
	d1, d2 = map(int, stdin.readline().split(" "))
	passcode = unlock(r1, r2, c1, c2, d1, d2)
	if passcode == ():
		stdout.write("-1\n")
	else:
		((m1, m2), (m3, m4)) = passcode
		stdout.write(str(m1) + " " + str(m2) + "\n" + str(m3) + " " + str(m4) + "\n")	
