import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class A
{
	BufferedReader in;
	PrintStream out;
	StringTokenizer tok;
	public A() throws NumberFormatException, IOException
	{
		in = new BufferedReader(new InputStreamReader(System.in));
		//in = new BufferedReader(new FileReader("in.txt"));
		out = System.out;
		run();
	}
	void run() throws NumberFormatException, IOException
	{
		int r1 = nextInt(),r2 = nextInt(),c1 = nextInt(),c2 = nextInt(),d1 = nextInt(),d2 =nextInt();
		for(int i= 1; i <=9; i++)
		{
			int a1 = i;
			int a2 = c1-i;
			int b1 = r1-i;
			int b2 = r2-a2;
			if(a1+b2==d1 && b1 + a2==d2 && a1!= a2 && a1!= b1 && a1 != b2 && b1 != a2 && b1 != b2 && a2 != b2 && b1 + b2==c2)
			{
				out.println(a1 + " " + b1);
				out.println(a2 + " " + b2);
				return;
			}
		}
		out.println("-1");
	}
	public static void main(String[] args) throws NumberFormatException, IOException 
	{
		new A();
	}
	String nextToken() throws IOException
	{
		if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());
		return tok.nextToken();
	}
	int nextInt() throws NumberFormatException, IOException
	{
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws NumberFormatException, IOException
	{
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws NumberFormatException, IOException
	{
		return Double.parseDouble(nextToken());
	}
}