N = int(input()) X = list(map(int,input().split())) A = list(map(int,input().split())) d = dict() for i,x in enumerate(X): d[x] = i G = [[] for _ in range(N)] for i in range(N): x = X[i] a = A[i] if x + a in d: G[d[x + a]].append(i) if x - a in d: G[d[x - a]].append(i) dp = [X[i] + A[i] for i in range(N)] top = [(X[i],A[i],i) for i in range(N)] top.sort(key = lambda x:x[0] + x[1],reverse = True) memo =[0] * N stack = [] for x,a,i in top: if memo[i] == 0: stack.append(i) memo[i] = 1 while stack: now = stack.pop() for j in G[now]: if memo[j] == 0: memo[j] = 1 dp[j] = dp[i] stack.append(j) for i in range(N): print(dp[i] - X[i])