from collections import defaultdict n = int(input()) x = list(map(int,input().split())) a = list(map(int,input().split())) d = defaultdict(int) hq = [] for i in range(n): d[x[i]] = a[i] hq.append([-x[i]-a[i] , i]) hq.append([-x[i]+a[i] , i]) ans = [0] * n hq.sort() for j in range(2*n): dist,i = hq[j] ans[i] = max(a[i] , d[x[i] + a[i]] + a[i] , d[x[i] - a[i]] - a[i],ans[i]) d[x[i]] = max(d[x[i]],ans[i]) print(*ans,sep="\n")