import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

import java.util.StringTokenizer;

/**
 *
 * @author Ahmed
 */
public class Test {

    /**
     * @param args the command line arguments
     * @throws java.io.IOException
     *
     *
     *
     */
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        StringTokenizer st = new StringTokenizer(in.readLine());
        byte r1 = Byte.parseByte(st.nextToken());
        byte r2 = Byte.parseByte(st.nextToken());
        StringTokenizer st1 = new StringTokenizer(in.readLine());
        byte c1 = Byte.parseByte(st1.nextToken());
        byte c2 = Byte.parseByte(st1.nextToken());
        StringTokenizer st2 = new StringTokenizer(in.readLine());
        byte d1 = Byte.parseByte(st2.nextToken());
        byte d2 = Byte.parseByte(st2.nextToken());
        int n1, n2, n3, n4;
        n2 = (d2 - c1 + r1) / 2;
        n4 = c2 - n2;
        n1 = r1 - n2;
        n3 = c1 - n1;
        if (n1 == n2 || n3 == n4 || n1 == n3 || n4 == n2 || n1 == n4 || n2 == n3 || n1 > 9 || n2 > 9 || n3 > 9 || n4 > 9) {
            out.write(-1 + "\n");
            out.flush();
            System.exit(0);
        }
        out.write(n1 + " " + n2 + "\n");
        out.write(n3 + " " + n4 + "\n");
        out.flush();
    }

}