#coding: utf-8
#Raquel Rufino

r1,r2 = map(int,raw_input().split())
c1,c2 = map(int,raw_input().split())
d1,d2 = map(int,raw_input().split())
ok =0

for i in range(1,10):
    
    for j in range(1,10):
        
        for k in range(1,10):
            
            for w in range(1,10):
                
                if i + j == r1 and k + w == r2 and i + k == c1 and j + w == c2 and i + w == d1 and j + k == d2 :
                    if i != j and i != k and i !=w and j != k and j != w and k != w :
                        print i,j
                        print k,w
                        ok = 1
                        break
if ok == 0 :
    print -1
        
