import sys
  
try:
  r1,r2 = eval('[' + ','.join(sys.stdin.readline().strip('\n\r ').split()) + ']')
  c1,c2 = eval('[' + ','.join(sys.stdin.readline().strip('\n\r ').split()) + ']')
  d1,d2 = eval('[' + ','.join(sys.stdin.readline().strip('\n\r ').split()) + ']')
  
  if r1>2 and r2>2 and c1>2 and c2>2 and d1>2 and d2>2:
    for topleft in range(1,r1):
      d = {}
  
      for j in range(1,10): d[j] = 0
  
      d[topleft] += 1
  
      topright = r1 - topleft
      if topright>9 or topright<1: continue
      if d[topright]>0: continue
      d[topright] += 1
  
      bottomleft = c1 - topleft
      if bottomleft>9 or bottomleft<1: continue
      if d[bottomleft]>0: continue
      d[bottomleft] += 1
  
      bottomright = c2 - topright
      if bottomright>9 or bottomright<1: continue
      if d[bottomright]>0: continue
      d[bottomright] += 1
  
      if (bottomright+bottomleft) != r2: continue
      if (bottomright+topleft) != d1: continue
      if (bottomleft+topright) != d2: continue
  
      print( "%d %d\n%d %d" % (topleft,topright,bottomleft,bottomright,) )

  else:
    print( -1 )
  
except:
  print( -1 )

