from itertools import *

def solve(r1,r2,c1,c2,d1,d2):
  for choice in combinations(xrange(1,10),4):
    for a,b,c,d in permutations(choice):
      if a+b==r1 and a+c==c1 and a+d==d1:
        if b+c==d2 and b+d==c2 and c+d==r2:
          print a,b
          print c,d
          return
  print -1

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