import sys
I=lambda:map(int, raw_input().split())
r1,r2=I()
c1,c2=I()
d1,d2=I()
for i in range(1,10):
  if i < r1 and r1 - i < 10:
    for j in range(1,10):
      if j < r2 and r2 - j < 10 and len(set([ i,j,r1-i,r2-j ])) == 4:
        if i+j == c1 and r1-i+r2-j==c2 and i+r2-j==d1 and j+r1-i==d2:
          print i, r1-i
          print j, r2-j
          sys.exit()
print -1