import java.util.Scanner;
public class Cf {
       public static void main(String[] args) {
      Scanner input = new Scanner(System.in);
int r1,r2 ,c1,c2,d1,d2;
r1=input.nextInt() ;r2=input.nextInt() ;c1=input.nextInt() ;
c2=input.nextInt() ;d1=input.nextInt() ;d2=input.nextInt() ;

int a,b,c,d ;
a=(r1+c1-d2)/2;
b=(r1+d2-c1)/2;
c=(c1+d2-r1)/2;
d=r2-c ; 
if(a<1 |a>9 |b<1 |b>9|c<1|c>9 |d<1|d>9) System.out.println("-1");
else if(a==b | a==c |a==d | b==c |b==d|c==d  ) System.out.println("-1");
      else     System.out.println(a+" "+b +"\n"+c+" "+d);

}

}