R1,R2=map(int,raw_input().split())
C1,C2=map(int,raw_input().split())
D1,D2=map(int,raw_input().split())
Y=(R1+D2-C1)/2
X=R1-Y
Z=D2-Y
T=D1-X
if not(X+Y==R1 and Z+T==R2 and X+T==D1 and Y+Z==D2 and X+Z==C1 and Y+T==C2):
    print -1
    exit(0)
if Y in[X,Z,T] or X in[Z,T,Y] or Z in[T,Y,X]or T in[X,Y,Z]:
    print -1
    exit(0)
if X<1 or Y<1 or Z<1 or T<1:
    print -1
    exit(0)
if X>9 or Y>9 or Z>9 or T>9:
    print -1
    exit(0)
print X,Y
print Z,T
