import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Random;
import java.util.StringTokenizer;

public class gems {
    private BufferedReader br;
    private StringTokenizer st;

    public  gems()
    {
        br=new BufferedReader(new InputStreamReader(System.in));

    }
    public  String read() throws IOException {
        while(st==null || !st.hasMoreElements()){
            st=new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    public   int Intparse() throws IOException {
        return Integer.parseInt(read());
    }



    public static void main(String[] args) throws IOException {
        gems g=new gems();
      
        int  r1=g.Intparse();
     
        int  r2=g.Intparse();
        
        int  c1=g.Intparse();
       
        int  c2=g.Intparse();
       
        int  d1=g.Intparse();
       
        int  d2=g.Intparse();
      
        int a=0,b=0,c=0,d=0;
        int count=0;
        while(count<10){
            count++;
            a=count;        
            b=r1-a;
            if(b==a && count<9)
                continue;
            c=c1-a;
            if((c==a ||c==b) && count<9)
                continue;
            d=r2-c;
            if((d==a || d==b||d==c)  && count<9)
                continue;

            if((a+b==r1&& a<10) && (d+c==r2&& d<10)   && (a+c==c1&& c<10) && (b+d==c2&& b<10)     && a+d==d1  && b+c==d2 )
               break;
            else if(count==9)
            {
                System.out.println(-1);
                System.exit(0);
            }
        }
        System.out.println(a+" "+b);
        System.out.println(c+" "+d);

    }
}
