import java.util.*;
import java.lang.Math.*;
public class qs1
{
     public static void main(String args[])throws Exception
     {
         Scanner in=new Scanner(System.in);
         int i,j,k,l,r1,r2,c1,c2,d1,d2,ctr=0;
         r1=in.nextInt();
         r2=in.nextInt();
         c1=in.nextInt();
         c2=in.nextInt();
         d1=in.nextInt();
         d2=in.nextInt();
         for(i=1;i<10;i++)
         {
             j=r1-i;
             k=c1-i;
             l=d1-i;
             if(j<=0 || k<=0 || l<=0)
             {
                 System.out.println("-1");ctr=1;break;
                }
                else if(i==j || j==k || k==l || i==l || i==k || j==l)
                continue;
                if(j+k==d2 && j+l==c2 && l+k==r2)
                {
                System.out.println(i+" "+j+" "+"\n"+k+" "+l);ctr=1;break;}
             
            }
         
         if(ctr==0)
         System.out.println("-1");
     }
}