l = lambda : map(int, raw_input().split())
rs, cs, ds = l(), l(), l()
f = lambda x: len(set(x))==len(x) \
          and x[0]+x[1]==rs[0] \
          and x[0]+x[2]==cs[0] \
          and x[1]+x[3]==cs[1] \
          and x[2]+x[3]==rs[1] \
          and x[0]+x[3]==ds[0] \
          and x[1]+x[2]==ds[1]
res = filter(f, [(x0, x1, x2, x3) for x0 in range(1, 10) for x1 in range(1, 10) for x2 in range(1, 10) for x3 in range(1, 10)])
print -1 if len(res)==0 else '%d %d\n%d %d' % res[0]
