import java.io.*;
import java.util.*;

public class A
{
    public static void main(String[] args)throws IOException
    {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String line;
        int r1,r2,c1,c2,d1,d2;
        line = input.readLine();
        StringTokenizer st = new StringTokenizer(line);
        r1 = Integer.parseInt(st.nextToken());
        r2 = Integer.parseInt(st.nextToken());
        line = input.readLine();
        st = new StringTokenizer(line);
        c1 = Integer.parseInt(st.nextToken());
        c2 = Integer.parseInt(st.nextToken());
        line = input.readLine();
        st = new StringTokenizer(line);
        d1 = Integer.parseInt(st.nextToken());
        d2 = Integer.parseInt(st.nextToken());
        for(int i=1;i<10;i++)
        {
            for(int j=1;j<10;j++)
            {
                for(int k=1;k<10;k++)
                {
                    for(int l=1;l<10;l++)
                    {
                        if(i+j==r1&&i+k==c1&&k+l==r2&&j+l==c2&&i+l==d1&&k+j==d2)
                        {
                            System.out.format("%d %d%n%d %d",i,j,k,l);
                            return;
                        }
                    }
                }
            }
        }
        System.out.print("-1");
    }
}