import java.util.Scanner;
import java.util.TreeSet;

public class Solution {

    public static void main(String[] args) throws Exception {
       Scanner reader = new Scanner(System.in);

       int r1 = reader.nextInt();
       int r2 = reader.nextInt();

       int c1 = reader.nextInt();
       int c2 = reader.nextInt();

       int d1 = reader.nextInt();
       int d2 = reader.nextInt();

       for (int leftup = 1; leftup <= 9; leftup++) {
           int rightdown = d1 - leftup;
           int rightup = c2 - rightdown;
           int leftdown = r2 - rightdown;

           if (c1 == leftdown + leftup && r1 == leftup + rightup && d2 == rightup + leftdown) {
               TreeSet<Integer> set = new TreeSet<Integer>();
               set.add(leftup);
               set.add(rightup);
               set.add(leftdown);
               set.add(rightdown);

               if (set.size() < 4) continue;

               System.out.println(String.format("%d %d%n%d %d", leftup, rightup, leftdown, rightdown));
               return;
           }
       }

       System.out.println("-1");
    }
}