
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.HashMap;

public class Main {

    public static void main(String[] args) {
        Main ob = new Main();
        Scanner in = new Scanner(System.in);
        ob.solve(in);
    }
    
    void solve(Scanner 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();
        for(int a=1; a<=9; a++){
            for(int b=1; b<=9; b++){
                for(int c=1; c<=9; c++){
                    for(int d=1; d<=9; d++){
                        if(a+b==r1 && c+d==r2 && a+c==c1 && b+d==c2
                                && a+d == d1 && b+c==d2){
                            if(a!=b  && a!=c && a!=d){
                                System.out.println(a+" "+b);
                                System.out.println(c+" "+d);
                                return;
                            }
                        }
                    }
                }
            }
        }
        System.out.println(-1);
        
    }
}
