r1, r2 = map(int, raw_input().strip().split())
c1, c2 = map(int, raw_input().strip().split())
d1, d2 = map(int, raw_input().strip().split())

for a in xrange(1, 20):
    for b in xrange(1, 20):
        for c in xrange(1, 20):
            for d in xrange(1, 20):
                if a + b == r1 and c + d == r2 and a + d == c1 and b + c == c2 and a + c == d1 and b + d == d2:
                    print a, b
                    print d, c
                    exit()
