

import itertools


first = [int(x) for x in raw_input().split()]
second = [int(x) for x in raw_input().split()]
third = [int(x) for x in raw_input().split()]

r1 = first[0]
r2 = first[1]
c1 = second[0]
c2 = second[1]
d1 = third[0]
d2 = third[1]

found = False
foundTuple = None

for c in itertools.combinations('123456789', 4):
  for p in itertools.permutations(list(c)):
    x = int(p[0])
    y = int(p[1])
    z = int(p[2])
    v = int(p[3])
	
    if x + z == c1 and y + v == c2 and x + y == r1 and z + v == r2 and x + v == d1 and y + z == d2:
      found = True
      foundTuple = (x, y, z, v)
      break

  if found:
    break  
	
	
if not found:
  print "-1"
else:
  print foundTuple[0], foundTuple[1]
  print foundTuple[2], foundTuple[3]
  
	