import java.util.Scanner;
public class problem143A {
    public static void main(String[] args) {
        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();       
        in.close();
        for (int s11 = 1; s11 <= 9; s11++) {
            int s12 = r1 - s11;
            int s21 = c1 - s11;
            int s22 = r2 - s21;
            if ((s11 + s12 == r1) && (s21 + s22 == r2) && (s11 + s21 == c1) && (s12 + s22 == c2) && (s11 + s22 == d1) && (s12 + s21 == d2) && 
                (s11 != s12) && (s11 != s21) && (s11 != s22) &&
                (s12 != s21) && (s12 != s22) &&
                (s21 != s22)) {
                System.out.println(s11 + " " + s12);
                System.out.println(s21 + " " + s22);
                return;
            }
        }
        System.out.println("-1");
    }
}
