import string;

def p():
    ii = [];
    ss = string.split(raw_input());
    for s in ss:
        ii.append(int(s));
    return int(ii[0]),int(ii[1]);

r1,r2=p();
c1,c2=p();
d1,d2=p();
_2b = (d2-r2+c2)
if (_2b % 2 != 0):
    print -1
else:
    b = _2b / 2
    d = c2 - b
    a = r1 - b
    c = d2 - b
    if (a == b) or (a == c) or (a == d) or (b == c) or (b == d) or (c == d) or (a < 1) or (a > 9) or (b < 1) or (b > 9) or (c < 1) or (c > 9) or (d < 1) or (d > 9):
        print -1
    else:
        print a,b
        print c,d