#include using namespace std; using ll = long long; using P = pair; #define fix(x) fixed << setprecision(x) #define asc(x) x, vector, greater #define rep(i, n) for(ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a mp; vector x(200200), a(200200), ans(200200); vector seen(200200,false); int dfs(int now){ if(seen[now]) return ans[now]; seen[now] = true; int res = x[now] + a[now]; if(mp.count(x[now]+a[now])){ int z = mp[x[now]+a[now]]; chmax(res, dfs(z)); } if(mp.count(x[now]-a[now])){ int z = mp[x[now]-a[now]]; chmax(res, dfs(z)); } return ans[now] = res; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; rep(i,n) cin >> x[i]; rep(i,n) cin >> a[i]; rep(i,n) mp[x[i]] = i; rep(i,n) dfs(i); rep(i,n) cout << ans[i]-x[i] << '\n'; return 0; }