Buggy python submission (verdict: Time Limit Exceeded):
def my_solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a, b, c = abc[:x], abc[x:x + y], abc[x + y:]
    ab = sorted([_a + _b for _b in b for _a in a])[-k:]
    *abc, = map(str, sorted([_ab + _c for _c in c for _ab in ab], reverse=True)[:k])
    return "\n".join(abc)


def solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a, b, c = map(sorted, [abc[:x], abc[x:x + y], abc[x + y:]])
    ans = []
    for ia, _a in enumerate(a[::-1], start=1):
        for ib, _b in enumerate(b[::-1], start=1):
            for ic, _c in enumerate(c[::-1], start=1):
                if ia * ib * ic <= k:
                    ans.append(_a + _b + _c)
                else:
                    break
    return "\n".join(list(map(str, sorted(ans, reverse=True)[:k])))


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(4)])))


Fixed submission:
def solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a = abc[:x]
    b = abc[x:x + y]
    c = abc[x + y:]
    ab = sorted([_a + _b for _b in b for _a in a])[-k:]
    *abc, = map(str, sorted([_ab + _c for _c in c for _ab in ab], reverse=True)[:k])
    return "\n".join(abc)


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(4)])))

Buggy python submission (verdict: Time Limit Exceeded):
def my_solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a, b, c = abc[:x], abc[x:x + y], abc[x + y:]
    ab = sorted([_a + _b for _b in b for _a in a])[-k:]
    *abc, = map(str, sorted([_ab + _c for _c in c for _ab in ab], reverse=True)[:k])
    return "\n".join(abc)


def solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a, b, c = map(sorted, [abc[:x], abc[x:x + y], abc[x + y:]])
    ans = []
    for ia, _a in enumerate(a[::-1], start=1):
        for ib, _b in enumerate(b[::-1], start=1):
            for ic, _c in enumerate(c[::-1], start=1):
                if ia * ib * ic <= k:
                    ans.append(_a + _b + _c)
                else:
                    break
    return "\n".join(list(map(str, sorted(ans, reverse=True)[:k])))


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(4)])))


Fixed submission:
def solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a = abc[:x]
    b = abc[x:x + y]
    c = abc[x + y:]
    ab = sorted([_a + _b for _b in b for _a in a])[-k:]
    *abc, = map(str, sorted([_ab + _c for _c in c for _ab in ab], reverse=True)[:k])
    return "\n".join(abc)


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(4)])))

Buggy python submission (verdict: Time Limit Exceeded):
def solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a, b, c = map(sorted, [abc[:x], abc[x:x + y], abc[x + y:]])
    ans = []
    for ia, _a in enumerate(a[::-1]):
        for ib, _b in enumerate(b[::-1]):
            for ic, _c in enumerate(c[::-1]):
                if ia * ib * ic < k:
                    ans.append(_a + _b + _c)
                else:
                    break
    return "\n".join(list(map(str, sorted(ans, reverse=True)[:k])))


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(4)])))


Fixed submission:
def solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a = abc[:x]
    b = abc[x:x + y]
    c = abc[x + y:]
    ab = sorted([_a + _b for _b in b for _a in a])[-k:]
    *abc, = map(str, sorted([_ab + _c for _c in c for _ab in ab], reverse=True)[:k])
    return "\n".join(abc)


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(4)])))

Buggy python submission (verdict: Time Limit Exceeded):
def solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a, b, c = map(sorted, [abc[:x], abc[x:x + y], abc[x + y:]])
    ans = []
    for ia, _a in enumerate(a[::-1]):
        for ib, _b in enumerate(b[::-1]):
            for ic, _c in enumerate(c[::-1]):
                if ia * ib * ic < k:
                    ans.append(_a + _b + _c)
                else:
                    break
    return "\n".join(list(map(str, sorted(ans, reverse=True)[:k])))


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(4)])))


Fixed submission:
def solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a = abc[:x]
    b = abc[x:x + y]
    c = abc[x + y:]
    ab = sorted([_a + _b for _b in b for _a in a])[-k:]
    *abc, = map(str, sorted([_ab + _c for _c in c for _ab in ab], reverse=True)[:k])
    return "\n".join(abc)


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(4)])))

Buggy python submission (verdict: Time Limit Exceeded):
def solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a, b, c = map(sorted, [abc[:x], abc[x:x + y], abc[x + y:]])
    ans = []
    for ia, _a in enumerate(a[::-1]):
        for ib, _b in enumerate(b[::-1]):
            for ic, _c in enumerate(c[::-1]):
                if ia * ib * ic < k:
                    ans.append(_a + _b + _c)
    return "\n".join(list(map(str, sorted(ans, reverse=True)[:k])))


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(4)])))


Fixed submission:
def solve(string):
    x, y, z, k, *abc = map(int, string.split())
    a = abc[:x]
    b = abc[x:x + y]
    c = abc[x + y:]
    ab = sorted([_a + _b for _b in b for _a in a])[-k:]
    *abc, = map(str, sorted([_ab + _c for _c in c for _ab in ab], reverse=True)[:k])
    return "\n".join(abc)


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(4)])))