#!/usr/bin/env python
"""(c) gorlum0 [at] gmail.com"""
import itertools as it
from sys import stdin

def solve(r1, r2, c1, c2, d1, d2):
    gems = range(1, 10)
    for a, b, c, d in it.product(gems, gems, gems, gems):
        if a == b or a == c or a == d or b == c or b == d or c == d:
            continue
        rows  = a + b == r1 and c + d == r2
        cols  = a + c == c1 and b + d == c2
        diags = a + d == d1 and b + c == d2
        if rows and cols and diags:
            return [a, b, c, d]
    return None

def main():
    for l in stdin:
        r1, r2 = map(int, l.split())
        c1, c2 = map(int, next(stdin).split())
        d1, d2 = map(int, next(stdin).split())

        scheme = solve(r1, r2, c1, c2, d1, d2)
        print '{0} {1}\n{2} {3}'.format(*scheme) if scheme else -1

if __name__ == '__main__':
    main()
