import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
        String s = bi.readLine();
        StringTokenizer t = new StringTokenizer(s);
        int[] rows = new int[2];
        rows[0] = Integer.parseInt(t.nextToken());
        rows[1] = Integer.parseInt(t.nextToken());
        s = bi.readLine();
        t = new StringTokenizer(s);
        int[] cols = new int[2];
        cols[0] = Integer.parseInt(t.nextToken());
        cols[1] = Integer.parseInt(t.nextToken());
        s = bi.readLine();
        t = new StringTokenizer(s);
        int[] diagonals = new int[2];
        diagonals[0] = Integer.parseInt(t.nextToken());
        diagonals[1] = Integer.parseInt(t.nextToken());

        int a = (rows[0] - cols[1] + diagonals[0])/2;
        int b = (cols[1] - diagonals[0] + rows[0])/2;
        int c = (rows[0]-cols[0] - diagonals[1])/ (-2);
        int d = (rows[0] - diagonals[0] - cols[1]) / (-2);

        boolean result = false;

        if ((((a > 0)&&(a < 10)) && ((b > 0)&&(b < 10)) && ((c > 0)&&(c < 10)) && ((d > 0)&&(d < 10))) && (a != b && b != c && c!= d && a != c && b != d && a != d)) {
            result = true;
        }
        if (a + b == rows[0] && c + d == rows[1] && cols[0] == a + c && cols[1] == b + d && diagonals[0] == a + d && diagonals[1] == b + c) {
            result = true;
        }
        if (result) {
            System.out.println(a + " " + b);
            System.out.println(c + " " + d);
        } else {
            System.out.println(-1);
        }
    }


}
