
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Integer.parseInt;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

        StringTokenizer tok;
        tok = new StringTokenizer(r.readLine());
        int r1 = parseInt(tok.nextToken());
        int r2 = parseInt(tok.nextToken());
        tok = new StringTokenizer(r.readLine());
        int c1 = parseInt(tok.nextToken());
        int c2 = parseInt(tok.nextToken());
        tok = new StringTokenizer(r.readLine());
        int d1 = parseInt(tok.nextToken());
        int d2 = parseInt(tok.nextToken());
        int x = 0, a = 0, b = 0, c = 0;
        boolean f = false;
        for (int i = 1; i <= 9; i++) {

            x = i;
            a = r1 - x;
            b = c1 - x;
            c = r2 - b;
            if (a >= 1 && b >= 1 && c >= 1 && a <= 9 && b <= 9 && c <= 9 && x >= 1 && x <= 9) {
                f = true;
                break;

            }

        }
        if (f == true&&x!=c&&a!=b) {
            System.out.println(x + " " + a);
            System.out.println(b + " " + c);
        } else {
            System.out.println(-1);
        }

    }

}
