//
// Created by 江口慎悟 on 2019-04-06.
//
#include <vector>
#include <iostream>
#include <limits>
#include <algorithm>
#include <queue>
#include <unordered_map>

using namespace std;
void a(){

    vector<int> antena(5);
    for(int i = 0; i < 5; i++){
        cin >> antena[i];
    }
    int k; cin >> k;

    bool ok =(antena[4] - antena[0] <= k);

    if (ok)
        cout << "Yay!";
    else
        cout << ":(";

}

void b(){


    int time_sum = 0;
    int max_loss = 0;
    int loss_sum = 0;
    for(int i = 0; i < 5; i++){
        int time; cin >> time;
        time_sum += time;
        int loss = (10 - time%10)%10;
        max_loss = (max_loss > loss)? max_loss:loss;
        loss_sum += loss;
    }

    int ans = time_sum + loss_sum - max_loss;

    cout << ans;
}


void c(){

    long long N; cin >> N;
    long long min_capa = numeric_limits<long long>::max();
    for(int i = 0; i < 5; i++){
        long long capa; cin >> capa;
        min_capa = min(min_capa, capa);
    }

    long long ans = ((N - 1)/min_capa) + 5;

    cout << ans;

}

class Choise{
public:
    long long oisisa;
    int a;
    int b;
    int c;

    Choise(long long oisisa, int a, int b, int c):oisisa(oisisa),a(a),b(b),c(c){};

    Choise():oisisa(0), a(0),b(0), c(0){};

    bool operator==(const Choise& rc) const;

    bool operator!=(const Choise& rc) const;


};

inline bool Choise::operator==(const Choise& rc) const {
    const Choise& lc = *this;
    return rc.oisisa == lc.oisisa && rc.a == lc.a && rc.b == lc.b && rc.c == lc.c;
}

inline bool Choise::operator!=(const Choise& rc) const {
    return !(this->operator==(rc));
}

class CHash{
public:
    size_t operator()(const Choise& choise) const { return hash<long long>()(choise.oisisa); }
};

void d(){
    int X; cin >> X;
    int Y; cin >> Y;
    int Z; cin >> Z;
    int K; cin >> K;

    vector<long long>A(X);
    vector<long long>B(Y);
    vector<long long>C(Z);

    for(int i = 0; i < X; i++) cin >> A[i];
    for(int i = 0; i < Y; i++) cin >> B[i];
    for(int i = 0; i < Z; i++) cin >> C[i];

    sort(A.begin(), A.end(), greater<long long>());
    sort(B.begin(), B.end(), greater<long long>());
    sort(C.begin(), C.end(), greater<long long>());

    auto comp = [](Choise a, Choise b){ return a.oisisa < b.oisisa;};

    priority_queue<Choise, vector<Choise>, decltype(comp) > q(comp);

    q.push(Choise(A[0] + B[0] + C[0], 0,0,0));

    vector<Choise> ranking(K);
    unordered_map<Choise, bool, CHash> chosen;

    for(int k = 0; k < K; k++){

        Choise top = q.top();
        q.pop();
        while( chosen.find(top) != chosen.end() ){ top = q.top(); q.pop();}
        chosen[top] = true;
        int a = top.a;
        int b = top.b;
        int c = top.c;
        if (a < X -1) q.push( Choise(A[a+1] + B[b] + C[c], a+1, b,c));
        if (b < Y - 1) q.push( Choise(A[a] + B[b+1] + C[c], a, b+1,c));
        if (c < Z -1 ) q.push( Choise(A[a] + B[b] + C[c+1], a, b,c+1));

        ranking[k] = top;
    }



    for(int k = 0; k < K; k++){
        long long oisisa = ranking[k].oisisa;
        int a = ranking[k].a;
        int b = ranking[k].b;
        int c = ranking[k].c;
        cout << oisisa <<  endl;
    }



}
int main(){

    d();
}

Measured memory_bytes: 768