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

fuck = 0

for i in range(1, 10):
    q1 = i
    q2 = r1 - q1
    q3 = c1 - q1
    q4 = d1 - q1
    if q1 != q2 and q1 !=  q3 and q1 != q4 and q2 != q3 and q2 != q4 and q3 != q4:
        if r1 == q1 + q2 and r2 == q3+q4 and c1 == q1 + q3 and c2 == q2 + q4 and d1 == q1 + q4 and d2 == q2 + q3:
            print(q1, q2)
            print(q3, q4)
            break
    fuck += 1

if fuck == 9:
    print(-1)
