import string

def pd(gems):
    for i in range(0, 4):
        for j in range(i + 1, 4):
            if gems[i] == gems[j]:
                return False
    return True

if __name__ == '__main__':
    line = [string.atoi(each) for each in raw_input().split()]
    r1 = line[0]
    r2 = line[1]
    line = [string.atoi(each) for each in raw_input().split()]
    c1 = line[0]
    c2 = line[1]
    line = [string.atoi(each) for each in raw_input().split()]
    d1 = line[0]
    d2 = line[1]
    
    gems = [-1] * 4
    find = False
    for i in range(1, 10):
        gems[0] = i
        gems[1] = r1 - i
        gems[2] = c1 - i
        gems[3] = c2 - gems[1]
        
        #print str(gems[0]) + ' ' + str(gems[1])
        #print str(gems[2]) + ' ' + str(gems[3])
        
        inlimit = True
        for each in gems:
            if each < 1 or each > 9:
                inlimit = False
        if(not inlimit): continue
        
        #print pd(gems)
        
        if((gems[0] + gems[3] == d1) and (gems[1] + gems[2] == d2) and (gems[2] + gems[3] == r2) and pd(gems)):
            find = True
            break
            
    if(find):
        print str(gems[0]) + ' ' + str(gems[1])
        print str(gems[2]) + ' ' + str(gems[3])
    else:
        print -1