
import java.util.*;

public class ProblemSolving {

    public static int indexOfArrayMax(int[][] arr){
        int max = arr[0][0];
        int index = 0;
        for(int i=0;i<arr.length;i++){
            if(arr[i][0]>max){
                max = arr[i][0];
                index = i;
            }
        }
        return index;
    }
    
    public static int smallestNumber(int...numbers){
        int minimum = numbers[0];
        for(int i=0;i<numbers.length;i++){
            if(minimum>numbers[i]){
                minimum = numbers[i];
            }
        }
        return minimum;
    }
    
    public static void main(String[] args) {

        Scanner scan=new Scanner(System.in);
        int[] edges = new int[6];

        for(int i=0;i<6;i++){
            edges[i] = scan.nextInt();
        }
        int[][] total = new int[4][2];
        total[0][0] = edges[0]+edges[2]+edges[4];
        total[0][1] = smallestNumber(edges[0],edges[2],edges[4])-1;
        
        total[1][0] = edges[0]+edges[3]+edges[5];
        total[1][1] = smallestNumber(edges[0],edges[3],edges[5])-1;
        
        total[2][0] = edges[1]+edges[2]+edges[5];
        total[2][1] = smallestNumber(edges[1],edges[2],edges[5])-1;
        
        total[3][0] = edges[1]+edges[3]+edges[4];
        total[3][1] = smallestNumber(edges[1],edges[3],edges[4])-1;
        
        int chosenIndex = indexOfArrayMax(total);
        
        int[] result = new int[4];
        result[chosenIndex] = total[chosenIndex][1];

        for(int i=0;i<4;i++){
            if(i!=chosenIndex){
                if(chosenIndex == 0){
                    if(i==1){
                        result[i] = edges[0]-result[chosenIndex];
                    }else if(i==2){
                        result[i] = edges[2]-result[chosenIndex];
                    }else if(i==3){
                        result[i] = edges[4]-result[chosenIndex];
                    }
                }else if(chosenIndex == 1){
                    if(i==0){
                        result[i] = edges[0]-result[chosenIndex];
                    }else if(i==2){
                        result[i] = edges[5]-result[chosenIndex];
                    }else if(i==3){
                        result[i] = edges[3]-result[chosenIndex];
                    }
                    
                    
                }else if(chosenIndex == 2){
                     if(i==0){
                        result[i] = edges[2]-result[chosenIndex];
                    }else if(i==1){
                        result[i] = edges[5]-result[chosenIndex];
                    }else if(i==3){
                        result[i] = edges[1]-result[chosenIndex];
                    }

                }else{
                    if(i==0){
                        result[i] = edges[4]-result[chosenIndex];
                    }else if(i==1){
                        result[i] = edges[3]-result[chosenIndex];
                    }else if(i==2){
                        result[i] = edges[1]-result[chosenIndex];
                    }
                }
            }
        }
        
        for(int i=0;i<4;i++){
            if(i==0){
                if(result[i]+result[i+1]!=edges[0]||result[i]+result[i+2]!=edges[2]||result[i]+result[i+3]!=edges[4]){
                    System.out.println(-1);
                    return;
                }
            }else if(i==1){
                if(result[i]+result[i-1]!=edges[0]||result[i]+result[i+1]!=edges[5]||result[i]+result[i+2]!=edges[3]){
                    System.out.println(-1);
                    return;
                }
            }else if(i==2){
                if(result[i]+result[i-2]!=edges[2]||result[i]+result[i-1]!=edges[5]||result[i]+result[i+1]!=edges[1]){
                    System.out.println(-1);
                    return;
                }                
            }else{
                if(result[i]+result[i-3]!=edges[4]||result[i]+result[i-2]!=edges[3]||result[i]+result[i-1]!=edges[1]){
                    System.out.println(-1);
                    return;
                }                    
            }
        }
        

        
        for(int i=0;i<4;i++){
            System.out.print(result[i]+" ");
            if(i==1){
                System.out.println();
            }
        }
        
        
    }

}
