// "static void main" must be defined in a public class.
import java.util.*;
public class Main {
    public static boolean checkSame(int a, int b, int c,int d){
      if(a< 0 || b<0 || c<0 || d< 0)
        return true;
      if(a ==b || a == c|| a== d)
        return true;
      if(b==c|| b==d)
        return true;
      if(c==d)
        return true; 
      return false;
    }
    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 > 9 || box2 > 9 || box3 > 9 || box4 > 9 || 
          checkSame(box1,box2,box3,box4))
          continue;
      
        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);
      }
      
        
    }
}