import itertools
NAME = "A"
try:
    inFile = open(NAME+".txt")
except:
    pass

def read():
    try:
        return inFile.readline().strip()
    except:
        return raw_input().strip()

b,a = map(int,read().split())
d,e = map(int,read().split())
c,f = map(int,read().split())

for z in itertools.permutations(range(1,10),4):
    if z[0]+z[1]==b and z[2]+z[3]==a and z[0]+z[2]==d and  z[1]+z[3]==e and z[0]+z[3]==c and z[1]+z[2]==f:
        print z[0],z[1]
        print z[2],z[3]
        break
else:
    print -1