// "static void main" must be defined in a public class.
import java.util.*;
public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);  
      int r1,r2,c1,c2,d1,d2; 
      r1 = sc.nextInt();
      r2 = sc.nextInt();
      c1 = sc.nextInt(); 
      c2 = sc.nextInt();
      d1 = sc.nextInt();
      d2 = sc.nextInt(); 
      int box1 =0,box2=0,box3= 0, box4 =0;  
      boolean found = false; 
      for(int i =1 ; i <= 9 ; i++) {
        //System.out.println(i);
        box1 = i; 
        box2= r1-i; 
        box3 = d2-box2;
        box4 = d1-box1; 
        //System.out.println(box1 + " " + box2 + " " + box3 + " "+ box4);
        if( (box1 !=box2) && (box3!=box4) && (box1 + box2) == r1 && (box1 + box4)== d1 && (box2 + box3) == d2 &&
          (box1+box3) == c1 && (box2+box4) ==c2 && (box1 + box4) ==d1  && (box3 +box4) == r2 ){
          found = true; 
          break;
        }
        
      }
      if(found){
        System.out.println(box1 + " " + box2);
        System.out.println(box3 + " " + box4); 
      }
      else{
        System.out.println(-1);
      }
      
        
    }
}