from sys import stdin, stdout
INF=1e11
# import math
def get_int(): return int(stdin.readline().strip())
def get_ints(): return map(int,stdin.readline().strip().split()) 
def get_array(): return list(map(int,stdin.readline().strip().split()))
def get_string(): return stdin.readline().strip()
def op(c): return stdout.write(c)
# from collections import defaultdict 
# for _ in range(int(stdin.readline())):
r1,r2=get_ints()
c1,c2=get_ints()
d1,d2=get_ints()
A=(d1-d2+c1-c2+2*r1)//4
B=(2*r1-d1+d2-c1+c2)//4
C=(3*c1-d1+d2+c2-2*r1)//4
D=(3*d1+d2-c1+c2-2*r1)//4
if A<=0 or B<=0 or C<=0 or D<=0 or A>=10 or B>=10 or C>=10 or D>=10:
    print(-1)
else:
    s=set()
    s.add(A)
    s.add(B)
    s.add(C)
    s.add(D)
    if len(s)<4:
        print(-1)
    else:    
        print(A,B)
        print(C,D) 