import java.util.Scanner;
import java.math.*;

public class New {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int r1 = input.nextInt();
		int r2 = input.nextInt();
		int c1 = input.nextInt();
		int c2 = input.nextInt();
		int d1 = input.nextInt();
		int d2 = input.nextInt();
		int[] x = {(r1-c2+d1)/2 ,   (c2-r2+d2)/2
				,   (r2-d1+c1)/2 ,   (c2-r1+d1)/2};
		boolean test = true;
		for(int i = 0; i<4; i++) {
			for(int j = i+1; j<4; j++) {
				if(x[i] == x[j] || x[i] <=0 || x[i] > 9 || x[j] <=0 || x[j] > 9) {
					System.out.println(-1);
					test = false;
					break;
				}
			}
			if(test == false) {
				break;
			}
		}
		if(test == true ) {
			if(x[0] + x[1] == r1 && x[2] + x[3] == r2 && x[0] + x[2] == c1 
			&&	x[1] + x[3] == c2 && x[0] + x[3] == d1 && x[1] + x[2] == d2)
			System.out.println(x[0] + " " + x[1] + "\n" + x[2] +" " +x[3]);
		}else {
			System.out.println(-1);
		}
	}
}
