
import java.util.Scanner;

public class C143 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int r1=sc.nextInt();
        int r2=sc.nextInt();
        int c1=sc.nextInt();
        int c2=sc.nextInt();
        int d1=sc.nextInt();
        int d2=sc.nextInt();

        int a=(d1+c1-r1)/2;
        int b=r1-a;
        int c=c1-a;
        int d=r2-c1+a;
        if((b+c)!=d2 || (c+d)!=r2 || (b+d)!=c2 || a==b || a==c || a==d || b==c || b==d || c==d || a<1 || a>9  || b<1 || b>9 || c<1 || c>9 || d<1 || d>9)
	    {
	        System.out.println("-1");
	        return;
	    }
	    System.out.println(a+" "+b);
	    System.out.println(c+" "+d);
    }
}
