#include using namespace std; using ll = long long; using pll = pair; #define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i) #define rep(i, n) drep(i, 0, n - 1) #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second const ll MOD = 1000000007; const ll MOD2 = 998244353; const ll INF = 1LL << 60; const ll N_MAX = 2e5; struct UnionFind{ vector parent; vector sizes; UnionFind(ll N) : parent(N), sizes(N, 1){ rep(i, N) parent[i] = i; } ll root(ll x){ if (parent[x] == x) return x; return parent[x] = root(parent[x]); } void unite(ll x, ll y){ ll rx = root(x); ll ry = root(y); if (rx == ry) return; if (sizes[rx] < sizes[ry]) swap(rx, ry); sizes[rx] += sizes[ry]; parent[ry] = rx; } bool same(ll x, ll y){ ll rx = root(x); ll ry = root(y); return rx == ry; } ll size(ll x){ return sizes[root(x)]; } }; int main(){ ll n; cin >> n; vector x(n), a(n); rep(i, n) cin >> x[i]; rep(i, n) cin >> a[i]; map mp; UnionFind UT(n); rep(i, n) mp[x[i]] = i; rep(i, n){ if(mp.find(x[i]-a[i]) != mp.end()){ UT.unite(i, mp[x[i]-a[i]]); } if(mp.find(x[i]+a[i]) != mp.end()){ UT.unite(i, mp[x[i]+a[i]]); } } vector d(n, 0); rep(i, n){ d[UT.root(i)] = max(d[UT.root(i)], x[i]+a[i]); } vector ans(n); rep(i, n) ans[i] = d[UT.root(i)]-x[i]; rep(i, n) cout << ans[i] << endl; }