#include using namespace std; template bool chmin(T& a, T b) { return a > b ? a = b, true : false; } template bool chmax(T& a, T b) { return a < b ? a = b, true : false; } template concept Iterable = requires(T t) { std::begin(t); std::end(t); }; template requires Iterable && (!is_same_v) ostream& operator<<(ostream& os, const T& container) { for (auto& element : container) os << element << ' '; return os; } template requires ranges::range && (!is_same_v, string>) && (!is_same_v, const char*>) ostream& operator<<(ostream& os, R&& range) { for (auto& element : range)os << element << ' '; return os; } template requires Iterable && (!is_same_v) istream& operator>>(std::istream& is, T& container) { for (auto& e : container)is >> e; return is; } using ll = long long; using ull = unsigned long long; using uint = unsigned int; template struct Edge { int to; T weight; bool operator==(Edge e) { return this->to == e.to and this->weight == e.weight; } bool operator<(Edge e) { return this->to == e.to ? this->weight < e.weight : this->to < e.to; } }; #ifdef _DEBUG #define SHOW(n) {const auto& _ret = n; cerr << #n << ": " << _ret << endl;} #define MSG(x) cerr << x << endl; #else #define SHOW(n) #define MSG(x) #endif //AtCoder Library #include using namespace atcoder; //using mint = modint998244353; using mint = modint1000000007; //using mint1 = dynamic_modint<0>; //using mint = modint; //mint::set_mod(); istream& operator>>(istream& is, mint& x) { ll r; is >> r; x = r; return is; } ostream& operator<<(ostream& os, mint& x) { os << x.val(); return os; } //boost //#include //using namespace boost::multiprecision; //using l3 = int128_t; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll n, k, t; cin >> n >> k >> t; vector a(n); vector b(n); cin >> a >> b; vector ord(n); { auto v = b; ranges::sort(v); for (int i = 0; i < n; ++i) { ord[i] = ranges::lower_bound(v, b[i]) - v.begin(); } } vector res; // tの残り、今の砂の量 auto sim = [&](auto&& f, char c, ll rem, ll cur)->ll { if (c == 'A') { ll mi = min(cur, rem); cur -= mi; rem -= mi; if (rem == 0)return cur; return f(f, 'B', rem, cur); } else { ll pl = min(k - cur, rem); cur += pl; rem -= pl; if (rem == 0)return cur; return f(f, 'A', rem, cur); } }; t %= 2 * k; for (int i = 0; i < n; ++i) { b[i] %= 2 * k; res.push_back(sim(sim, a[i], t, b[i])); } ranges::sort(res); for (int i = 0; i < n; ++i) { cout << res[ord[i]] << " "; } cout << endl; return 0; }