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

public class Main {
	Scanner sc = new Scanner(System.in);
	PrintWriter pw =new PrintWriter(System.out);
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
		main.sc.close();
		main.pw.close();
	}
	void run() {
		int r1 = sc.nextInt();
		int r2 = sc.nextInt();
		int c1 = sc.nextInt();
		int c2 = sc.nextInt();
		int d1 = sc.nextInt();
                int d2 = sc.nextInt();
                for (int a = 1; a < 9; a++) {
                	int b = r1 - a;
                	int c = c1 - a;
                	int d = d1 - a;
                	if (r2 == c + d && c2 == b + d && d2 == b + c) {
                		pw.println("" + a + " " + b);
                		pw.print("" + c + " " + d);
                		return;
                	}
                }
                pw.print("-1");
	}
}