r,R=map(int,raw_input().split(" "))
c,C=map(int,raw_input().split(" "))
d,D=map(int,raw_input().split(" "))
#
def distinct(l):
    a=1
    for x in range(1,4):
        if l[x] not in l[0:x]:
            a+=1
    if a==4:
        return True
    else:
        return False
#
def where(l):
    a=0
    for x in l:
        if x in range(1,10):
            a+=1
    if a==4:
        return True
    else:
        return False
#
x=r+c-D
if x%2:
    print -1
else:
    m=x/2
    n=r-m
    o=c-m
    p=R-o
    l=[m,n,o,p]
    if (m+p==d and n+o==D) and distinct(l) and where(l):
        print m,n
        print o,p
    else:
        print -1