import java.util.Scanner;
public class HelpVasilisaTheWise2 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int r1 = sc.nextInt(), r2 = sc.nextInt(), c1 = sc.nextInt(), c2 = sc.nextInt(), d1 = sc.nextInt(), d2 = sc.nextInt();
		int a = 0, b = 0, c = 0, d = 0;
		int min = Math.min(10, Math.min(r1, Math.min(c1, d1)));
		sc.close();
		for(int i = 1; i <= min; i++){
			a = i;
			b = r1 - a;
			c = c1 - a;
			d = d1 - a;
			if(a + b == r1 && a + c == c1 && c + d == r2 && b + d == c2 &&
				a + d == d1 && b + c == d2 && a != b && a != c && a != d && 
				b != c && b != d && c != d && a < 10 && b < 10 && c < 10 && d < 10){
				System.out.printf("%d %d%n%d %d", a, b, c, d);
				System.exit(0);
			}
		}
		System.out.println(-1);
	}
}