#!/usr/bin/env python

import itertools

(r1,r2) = map(int, raw_input().split())
(c1,c2) = map(int, raw_input().split())
(d1,d2) = map(int, raw_input().split())

def check(a,b,c,d):
  return (r1 == (a+b)) and (r2 == (c+d)) and (c1 == (a+c)) and (c2 == (b+d)) and (d1 == (a+d)) and (d2 == (b+c)) 

for (a,b,c,d) in itertools.permutations(range(1,10), 4):
  if check(a,b,c,d):
    print a,b
    print c,d
    exit()

print -1
