import sys
import math
import itertools

def solve(r1, r2, c1, c2, d1, d2):
  for i in range(1, 10):
    for j in range(1, 10):
      for i2 in range(1, 10):
        for j2 in range(1, 10):
          if len([i, j, i2, j2]) != len(list(set([i, j, i2, j2]))):
            continue
          
          if (i + j == r1) and (i2 + j2 == r2) and (i + i2 == c1) and (j + j2 == c2) and (i + j2 == d1) and (j + i2 == d2):
            print i, j
            print i2, j2
            return True
          
        
  
if __name__ == '__main__':
  r = [int(i) for i in raw_input().rstrip().split(" ")]
  r1 = r[0]
  r2 = r[1]

  c = [int(i) for i in raw_input().rstrip().split(" ")]
  c1 = c[0]
  c2 = c[1]

  d = [int(i) for i in raw_input().rstrip().split(" ")]
  d1 = d[0]
  d2 = d[1]

  ret = solve(r1, r2, c1, c2, d1, d2)
  if ret != True:
    print "-1"
  
 
  
  
