# In the Name of God
r1,r2 = map(int,raw_input().split())
c1,c2 = map(int,raw_input().split())
d1,d2 = map(int,raw_input().split())
try: # :-)
    for i in range (1111 ,9999):
        l = map(int,str(i))
        st = set(l)
        if len(st)==4 and (0 not in l):
            if l[0]+l[1]==r1 and l[2]+l[3]==r2:
                if l[0]+l[2]==c1 and l[1]+l[3]==c2:
                    if l[0]+l[3]==d1 and l[1]+l[2]==d2:
                        a/=0 # :-P
    print -1
except:
    print l[0],l[1]
    print l[2],l[3]
