#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

class K_priority_queue {
private:
  i64 K;
  std::priority_queue<i64> queue;

public:
  K_priority_queue(const i64 K) :
    K(K) {
  }

  bool push(const i64 x) {
    if (static_cast<i64>(this->queue.size()) < K) {
      this->queue.push(x);
      return true;
    } else {
      if (x < this->queue.top()) {
        this->queue.push(x);
        this->queue.pop();
        return true;
      } else {
        return false;
      }
    }
  }

  std::vector<i64> to_vector() {
    std::vector<i64> vector;
    while (!this->queue.empty()) {
      vector.push_back(this->queue.top());
      this->queue.pop();
    }
    std::reverse(vector.begin(), vector.end());
    return vector;
  }
};

class cake_type {
public:
  i64 size;
  i64 accepted_size;
  i64 max;
  std::vector<i64> cakes;
  std::vector<std::vector<cake_type>::iterator> other_cake_types;
};

int main() {
  std::vector<cake_type> cake_types(3);
  for (i64 i = 0; i < 3; ++i) {
    for (i64 j = 0; j < 3; ++j) {
      if (i == j) continue;
      cake_types[i].other_cake_types.push_back(cake_types.begin() + j);
    }
  }

  for (cake_type& cake_type : cake_types) {
    std::cin >> cake_type.size;
  }
  i64 K;
  std::cin >> K;
  for (cake_type& cake_type : cake_types) {
    tools::read(cake_type.cakes, cake_type.size);
  }

  for (cake_type& cake_type : cake_types) {
    std::sort(cake_type.cakes.begin(), cake_type.cakes.end(), std::greater<i64>());
    cake_type.max = cake_type.cakes.front();
    std::transform(cake_type.cakes.begin(), cake_type.cakes.end(), cake_type.cakes.begin(), [&cake_type](const i64& cake) { return cake_type.max - cake; });
  }

  K_priority_queue queue(K);
  for (cake_type& cake_type : cake_types) {
    cake_type.accepted_size = 1;
  }
  bool inserted_new_cake = queue.push(0);

  while (inserted_new_cake && std::any_of(cake_types.begin(), cake_types.end(), [](const cake_type& cake_type) { return cake_type.accepted_size < cake_type.size; })) {
    std::vector<std::vector<cake_type>::iterator> next;
    next.push_back(std::min_element(cake_types.begin(), cake_types.end(), [](const cake_type& x, const cake_type& y) {
      static const auto key = [](const cake_type& cake_type) {
        return cake_type.accepted_size < cake_type.size ? cake_type.cakes[cake_type.accepted_size] : std::numeric_limits<i64>::max();
      };
      return key(x) < key(y);
    }));
    for (auto& other_cake_type : next[0]->other_cake_types) {
      next.push_back(other_cake_type);
    }

    i64 i;
    for (i = 0; i < next[1]->accepted_size; ++i) {
      i64 j;
      for (j = 0; j < next[2]->accepted_size && queue.push(next[0]->cakes[next[0]->accepted_size] + next[1]->cakes[i] + next[2]->cakes[j]); ++j);
      if (j == 0) break;
    }
    inserted_new_cake = i > 0;
    if (inserted_new_cake) ++next[0]->accepted_size;
  }

  std::vector<i64> answers = queue.to_vector();
  const i64 max = std::accumulate(cake_types.begin(), cake_types.end(), static_cast<i64>(0), [](const i64 sum, const cake_type& cake_type) {
    return sum + cake_type.max;
  });
  std::transform(answers.begin(), answers.end(), answers.begin(), [&max](const i64& v) { return max - v; });

  for (const i64& answer : answers) {
    std::cout << answer << std::endl;
  }
  return 0;
}

Measured memory_bytes: 384