s=raw_input()
l=s.split()
r1=int(l[0])
r2=int(l[1])
s = raw_input()
l = s.split()
c1=int(l[0])
c2=int(l[1])
s = raw_input()
l = s.split()
d1=int(l[0])
d2=int(l[1])
flag=0

for a in range(1,10):
         for b in range(1,10):
                 for c in range(1,10):
                         for d in range(1,10):
                                 if a+b==r1 and c+d==r2 and a+c==c1 and b+d==c2 and a+d==d1 and b+c==d2 and a!=b and a!=c and a!=d and b!=c and b!=d and c!=d and a+b+c+d<=20:
                                         print str(a)+" "+str(b)
                                         print str(c)+" "+str(d)
                                         flag=1
                                         break
if not flag:
        print -1
                                 
                                  
                                                                                 



        
        

