import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int r1 = in.nextInt();
        int r2 = in.nextInt();
        int c1 = in.nextInt();
        int c2 = in.nextInt();
        int d1 = in.nextInt();
        int d2 = in.nextInt();
        for(int x11 = 1; x11 < 10; x11++)
            for(int x12 = 1; x12 < 10; x12++)
                for(int x21 = 1; x21 < 10; x21++)
                    for(int x22 = 1; x22 < 10; x22++) {
                        if (x11 + x12 == r1 && 
                                x21+x22 == r2 &&
                                x11+x21 == c1 &&
                                x12+x22 == c2 &&
                                x11+x22 == d1 &&
                                x12+x21 == d2) {
                            System.out.println(x11 + " " + x12);
                            System.out.print(x21 + " " + x22);
                            in.close();
                            return;
                        }
                    }
        System.out.print(-1);
        in.close();
    }

}
