import java.util.Scanner;

public class helpVasilisa {
    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 rlc,ruc,luc,llc;
        if(d1<10){
            rlc=d1-1;
            luc=d1-rlc;
        }else{
            rlc=9;
            luc=d1-rlc;
        }
        while(true){
            llc=c1-luc;
            if(llc>=10){
                rlc--;
                luc++;
                continue;
            }
            if(rlc>10||luc>10||rlc<0||rlc==luc){
                System.out.println("-1");
                return;
            }
            break;
        }
        ruc=c2-rlc;
        if(ruc>10||ruc<=0||ruc==luc||ruc==rlc||rlc==luc||rlc==llc||llc==luc){
            System.out.println(-1);
        }else{
            System.out.println(luc+" "+ruc);
            System.out.println(llc+" "+rlc);
        }
    }
}
