import sys sys.setrecursionlimit(10 ** 6) #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') N = int(input()) X = list(map(int, input().split())) A = list(map(int, input().split())) x2i = {} for i in range(N): x2i[X[i]] = i memo = [0] * N def dfs(p, used): if memo[p] != 0: return memo[p] c = X[p] + A[p] for s in (1, -1): x = X[p] + A[p] * s if x in x2i: j = x2i[x] if used[j]: continue used[j] = True c = max(c, dfs(j, used)) used[j] = False memo[p] = c return memo[p] xs = [(X[i] + A[i], i) for i in range(N)] xs.sort(reverse=True) for d, i in xs: used = [False] * N dfs(i, used) for i in range(N): print(memo[i] - X[i])