unittest
{
	assert( [ "2 2 2 8", "4 6", "1 5", "3 8" ].solve == "19\n17\n15\n14\n13\n12\n10\n8" );
	assert( [ "3 3 3 5", "1 10 100", "2 20 200", "1 10 100" ].solve == "400\n310\n310\n301\n301" );
	assert( [ "10 10 10 20", "7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488", "1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338", "4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736" ].solve == "23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547" );
}



import std.algorithm;
import std.container;
import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto x = 0L;
	auto y = 0L;
	auto z = 0L;
	auto k = 0L;
	input.front.formattedRead!"%s %s %s %s"( x, y, z, k );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	input.popFront;
	auto bs = input.front.split.to!( long[] );
	input.popFront;
	auto cs = input.front.split.to!( long[] );
	as.sort!( ( a, b ) => b < a );
	bs.sort!( ( a, b ) => b < a );
	cs.sort!( ( a, b ) => b < a );
	
	auto rbt = new RedBlackTree!( long, ( a, b ) => b < a, true )( as.front + bs.front + cs.front );
	auto af = false;
	auto bf = false;
	auto cf = false;
	foreach( i; 1L .. k )
	{
		auto u = false;
		u |= solve2( rbt, k, [ as, bs, cs ], i );
		u |= solve2( rbt, k, [ bs, as, cs ], i );
		u |= solve2( rbt, k, [ cs, as, bs ], i );
		u |= solve3( rbt, k, [ as, bs, cs ], i );
		u |= solve3( rbt, k, [ bs, cs, as ], i );
		u |= solve3( rbt, k, [ cs, as, bs ], i );
		u |= solve4( rbt, k, [ as, bs, cs ], i );
		if( !u ) break;
	}
	return rbt[].map!( ( a ) => a.to!( string ) ).join( "\n" );
}

auto solve2( RBT )( ref RBT rbt, long k, long[][] abcs, long i )
{
	auto u = false;
	if( i < abcs[ 0 ].length )
	{
		auto a = abcs[ 0 ][ i ];
		foreach( b; abcs[ 1 ][ 0L .. min( i, $ ) ] )
		{
			foreach( c; abcs[ 2 ][ 0L .. min( i, $ ) ] )
			{
				auto t = a + b + c;
				if( rbt.length == k && t <= rbt.back ) break;
				rbt.insert( t );
				if( k < rbt.length ) rbt.removeBack;
				u = true;
			}
		}
	}
	return u;
}

auto solve3( RBT )( ref RBT rbt, long k, long[][] abcs, long i )
{
	auto u = false;
	if( i < abcs[ 0 ].length && i < abcs[ 1 ].length )
	{
		auto a = abcs[ 0 ][ i ];
		auto b = abcs[ 1 ][ i ];
		foreach( c; abcs[ 2 ][ 0L .. min( i, $ ) ] )
		{
			auto t = a + b + c;
			if( rbt.length == k && t <= rbt.back ) break;
			rbt.insert( t );
			if( k < rbt.length ) rbt.removeBack;
			u = true;
		}
	}
	return u;
}

auto solve4( RBT )( ref RBT rbt, long k, long[][] abcs, long i )
{
	auto u = false;
	if( i < abcs[ 0 ].length && i < abcs[ 1 ].length && i < abcs[ 2 ].length )
	{
		auto a = abcs[ 0 ][ i ];
		auto b = abcs[ 1 ][ i ];
		auto c = abcs[ 2 ][ i ];
		auto t = a + b + c;
		if( rbt.length == k && t <= rbt.back ) return u;
		rbt.insert( t );
		if( k < rbt.length ) rbt.removeBack;
		u = true;
	}
	return u;
}


Measured memory_bytes: 4140