####################################################
# -*- coding: utf-8 -*-
import sys

w = sys.stdout.write
read = sys.stdin.readline
reads = sys.stdin.read

def r(f=None):
    if f:
        return map(f, read().split())
    else:
        return read().split()

def rs(t,f=None):
    result = []
    result_append = result.append
    for i in xrange(t):
        if f:
            result_append(tuple(map(f, read().split())))
        else:
            result_append(list(read().split()))
    return result


####################################################
import math
sqrt = math.sqrt
from collections import deque


[r1, r2] = r(int)
[c1, c2] = r(int)
[d1, d2] = r(int)

for x1 in range(1, 10, 1):
    x2 = r1 - x1
    x3 = c1 - x1
    x4 = c2 - x2
    print x1, x2, x3, x4
    if x1 + x2 == r1 and x3 + x4 == r2 and x1 + x3 == c1 and x2 + x4 == c2 and x1 + x4 == d1 and x2 + x3 == d2\
        and 1 <= x1 <= 9 and 1 <= x2 <= 9 and 1 <= x3 <= 9 and 1 <= x4 <= 9 and len(list(set([x1, x2, x3, x4]))) == 4:
            w("%s %s\n%s %s" % (x1, x2, x3, x4))
            sys.exit()

w("-1")