import random
r1 , r2 = map(int, input().split())
c1 , c2 = map(int, input().split())
d1 , d2 = map(int, input().split())
n1 = random.randint(1,9)
n2 = random.randint(1,9)
n3 = random.randint(1,9)
n4 = random.randint(1,9)
count = 0
if ((r1 == c1) & (r2 == c2)):
    print(-1)
else:
    while (count <= 9**4):
        if ((c1 == n1+n3) & (c2 == n2+n4) & (r1 == n1+n2) & (r2 == n3+n4) & (d1 == n1+n4) & (d2 == n2+n3)):
            if ((n1 != n2) & (n2 != n4) & (n4 != n3) & (n3 != n1)):
                print(n1,' ',n2)
                print(n3,' ',n4)
                count = 0
                break
        else:
            n1 = random.randint(1,9)
            n2 = random.randint(1,9)
            n3 = random.randint(1,9)
            n4 = random.randint(1,9)
            count += 1
    if (count != 0):
        print(-1)