import java.io.*;
import java.util.*;

public class Main {
    static int r1;
    static int r2;
    static int c1;
    static int c2;
    static int d1;
    static int d2;
    static int n=2;
    static boolean check1;
    static boolean check2;
    static boolean check3;
    static boolean check4;
    static int[][] ans;
    public static boolean check(int[][] ans){
        return r1==ans[0][0]+ans[0][1] && r2==ans[1][0]+ans[1][1] && c1==ans[0][0]+ans[1][0] && c2==ans[0][1]+ans[1][1] && d1==ans[0][0]+ans[1][1] && d2==ans[0][1]+ans[1][0];
    }   
        
    public static void main(String[] args) throws NumberFormatException, IOException {
        Scanner in = new Scanner(new InputStreamReader(System.in));
        PrintWriter out=new PrintWriter(System.out);
        r1=in.nextInt();
        r2=in.nextInt();
        c1=in.nextInt();
        c2=in.nextInt();
        d1=in.nextInt();
        d2=in.nextInt();
        ans=new int[n][n];
        for(int i=0; i<n; i++){
            Arrays.fill(ans[i], 1);
        }
        all:
        for(int i=1; i<10; i++){
            for(int j=1; j<10; j++){
                for(int k=1; k<10; k++){
                    for(int l=1; l<10; l++){
                        ans[0][0]=i;
                        ans[0][1]=j;
                        ans[1][0]=k;
                        ans[1][1]=l;
                        if(check(ans) && i!=j && j!=k && k!=l && l!=i){
                            break all;
                        }
                    }
                }
            }
        }
        if(check(ans)){
            for(int i=0; i<n; i++){
                for(int j=0; j<n; j++){
                    out.print(ans[i][j]+" ");
                }
                out.println();
            }
        }
        else{
            out.println(-1);
        }
        out.close();
    }
    
}