#!/usr/bin/env python

import itertools

r1,r2 = map(int, raw_input().split())
c1,c2 = map(int, raw_input().split())
d1,d2 = map(int, raw_input().split())

solution = None
for option in itertools.permutations(xrange(1,10), 4):
  if ((option[0] + option[1]) == r1) and \
     ((option[2] + option[3]) == r2) and \
     ((option[0] + option[3]) == d1) and \
     ((option[0] + option[2]) == c1) and \
     ((option[1] + option[3]) == c2) and \
     ((option[1] + option[2]) == d2):
     solution = option
     break

if solution != None:
  print "%d %d" % (solution[0], solution[1])
  print "%d %d" % (solution[2], solution[3])
else:
  print -1
