import java.util.Scanner;


public class A {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int r1=in.nextInt();
		int r2=in.nextInt();
		int c1=in.nextInt();
		int c2=in.nextInt();
		int d1=in.nextInt();
		int d2=in.nextInt();
		
		int a=0,b=0,c=0,d = 0;
		boolean flag=false;
		for(int i=1;i<10;i++){
			a=i;
			b=r1-a;
			c=c1-a;
			d=c2-b;
			if((a+b==r1) && (c+d==r2) && (a+c==c1) && (b+d==c2) && (a+d==d1) && (b+c==d2)){
				flag=true;
				break;
				
			}
		}

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

	}

}
