#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<ll> X(N + 1), A(N + 1);
    rep(i, N) cin >> X[i];
    rep(i, N) cin >> A[i];
    X[N] = 1e18, A[N] = 0;

    vector<bool> seen(N);
    vector<ll> ans(N);
    rep(i, N) {
        auto calc = [&](auto &&self, int idx) -> ll {
            if (seen[idx]) return ans[idx];

            seen[idx] = true;

            // 右に投げて終わり
            ans[idx] = A[idx];

            // 右に投げて更に投げる
            auto rid = lower_bound(X.begin(), X.end(), X[idx] + A[idx]) - X.begin();
            if (X[rid] == X[idx] + A[idx]) {
                ans[idx] = max(ans[idx], A[idx] + self(self, rid));
            }

            // 左に投げて更に投げる
            auto lid = lower_bound(X.begin(), X.end(), X[idx] - A[idx]) - X.begin();
            if (X[lid] == X[idx] - A[idx]) {
                ans[idx] = max(ans[idx], -A[idx] + self(self, lid));
            }

            return ans[idx];
        };

        seen[i] = false;
        calc(calc, i);
    }
    for (ll a : ans)
        cout << a << "\n";

    return 0;
}