import java.util.*;
import java.lang.*;

public class A {
    public static void main(String[] args) {
        // getting the inputs
        Scanner in = new Scanner(System.in);
        int r1 = in.nextInt();
        int r2 = in.nextInt();
        int c1 = in.nextInt();
        int c2 = in.nextInt();
        int d1 = in.nextInt();
        int d2 = in.nextInt();
        // printing the output
        new Solver().solve(r1,r2,c1,c2,d1,d2);
    }
}

class Solver {
    public void solve(int r1, int r2, int c1, int c2, int d1, int d2) {  
        if(r1 == 1 || r2 == 1 || c1 == 1 || c2 == 1 || d1 == 1 || d2 == 1) {
            System.out.println("-1");
            return;
        }
        if(r1 == 2 || r2 == 2 || c1 == 2 || c2 == 2 || d1 == 2 || d2 == 2) {
            System.out.println("-1");
            return;
        }
        if(r1 > 17 || r2 > 17 || c1 > 17 || c2 > 17 || d1 > 17 || d2 > 17) {
            System.out.println("-1");
            return;
        }
        if(r1 == c1 || r1 == c2 || r1 == d1 || r1 == d2) {
            System.out.println("-1");
            return;
        }
        if(r2 == c1 || r2 == c2 || r2 == d1 || r2 == d2) {
            System.out.println("-1");
            return;
        }
        if(c1 == d1 || c1 == d2 || c2 == d1 || c2 == d2) {
            System.out.println("-1");
            return;
        }
        int[] ans = new int[4];
        int x = Math.min(r1, Math.min(d1, Math.min(c1, Math.min(c2, d2)))) - 1;
        if(c1 >= c2) {
            ans[0] = x;
            ans[1] = r1 - x;
            ans[2] = c1 - x;
            ans[3] = d1 - x;
            while(ans[1] + ans[3] != c2) {
                ans[0]--;
                ans[1]++;
                ans[2]++;
                ans[3]++;
                if(ans[0] == 0 || ans[1] > 9 || ans[2] > 9 || ans[3] > 9) {
                    System.out.println("-1");
                    return;
                }
            }
        }
        else {
            ans[1] = x;
            ans[0] = r1 - x;
            ans[2] = d2 - x;
            ans[3] = c2 - x;
            while(ans[0] + ans[2] != c1) {
                ans[1]--;
                ans[0]++;
                ans[2]++;
                ans[3]++;
                if(ans[1] == 0 || ans[0] > 9 || ans[2] > 9 || ans[3] > 9) {
                    System.out.println("-1");
                    return;
                }
            }
        }
        System.out.println(ans[0] + " " + ans[1]);
        System.out.println(ans[2] + " " + ans[3]);
    }
}
