
### Codeforces Problem 143 A

r1, r2 = map(int, raw_input().split(' '))
c1, c2 = map(int, raw_input().split(' '))
d1, d2 = map(int, raw_input().split(' '))

solution = -1

for i in range(1,10):
# Set value of a
    a = i

    # Derive the other three
    b = r1-a
    c = c1-a
    d = d1-a

    # Check whether they are unique

    if len(set([a,b,c,d])) < 4:
        break
        
    if r2 == c+d and c2 == b+d and d2 == b+c and max(a,b,c,d) <10 and min(a,b,c,d)>0:
        solution = " ".join([str(a), str(b)]) + "\n" + " ".join([str(c), str(d)])
        break

print solution        