import math

def main():
    r1,r2 = [int(x) for x in input().split()]
    c1,c2 = [int(x) for x in input().split()]
    d1,d2 = [int(x) for x in input().split()]
    a = math.floor((r1 - c2 + d1)/2)
    b = r1 - a
    c = c1 - a
    d = d1 - a
    if a == b or a == c or a == d or b == c or b == d or c == d:
        print(-1)
    elif (b + c) != d2 and (c + d) != r2 :
        print(-1)
    elif a > 9 or b > 9 or c > 9 or d > 9:
        print(-1)
    else:
        print(a, b)
        print(c, d)

if __name__ == '__main__':
    main()
