s= raw_input().split()

r1 = int(s[0])
r2 = int(s[1])

s= raw_input().split()

c1 = int(s[0])
c2 = int(s[1])

s= raw_input().split()

d1 = int(s[0])
d2 = int(s[1])

check=0
for a in range(1,10):
 for b in range(1,10):
  for c in range(1,10):
   for d in range(1,10):
    if  a==b or b==c or c==d or d==a or a==c or b==d:
     check=0
    else: 
     if c1 == a+c and c2== b+d and r1== a+b and r2== c+d and d1== a+d and d2== b+c:
      print a,b
      print c,d
      check=1
      exit(0)
      
if check==0:
 print -1