
import sys

def read2():
   return map(int, raw_input().split())

r1, r2 = read2()
c1, c2 = read2()
d1, d2 = read2()

for i in range(1, r1):
   a = i
   b = r1 - i
   if (b <= 0 or b > 9 or b == a): continue
   c = c1 - a
   if (c <= 0 or c > 9 or c == a or c == b): continue
   d = c2 - b
   if (d <= 0 or d > 9 or d == a or d == b or d == c): continue
   print a, b
   print c, d
   sys.exit(0)

print -1
