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

public class Main {

    public static void main(String[] args) {
    	Scanner s = new Scanner(System.in);
    	int r1 = s.nextInt();
    	int r2 = s.nextInt();
    	int c1 = s.nextInt();
    	int c2 = s.nextInt();
    	int d1 = s.nextInt();
    	int d2 = s.nextInt();
    	int y = (r1-c1+d2)/2;
    	int x = r1 - y;
    	int z = c1 - x;
    	int a = r2 - z;
    	Set<Integer> set = new HashSet<Integer>();
    	if(y > 0 && y <= 9 && x > 0 && x <= 9 &&
    		z > 0 && z <= 9 && a > 0 && a <= 9) {
    		if(set.add(y) && set.add(x) && set.add(z) && set.add(a))
    			System.out.println(x + " " + y + "\n" + z + " " + a);
    		else
    			System.out.println(-1);
    	}
    	else
    		System.out.println(-1);
    }
}
