r1,r2 = map(int, raw_input().split())
c1,c2 = map(int, raw_input().split())
d1,d2 = map(int, raw_input().split())
b = (d2+c2-r2)/2
c = r2-c2+b
a = r1-b
d = c2-b
maxi = max(a,max(b,max(c,d)))
mini = min(a,min(b,min(c,d)))
r = set([a,b,c,d])
if maxi>9 or mini<0: print '-1'
elif len(r)<4: print '-1'
else:
   print a,b
   print c,d
