#int(input()) #map(int, input().split()) #list(map(int, input().split())) import sys sys.setrecursionlimit(200000) N = int(input()) X = list(map(int, input().split())) A = list(map(int, input().split())) import bisect to = [[] for i in range(N)] for i in range(N): a = X[i] + A[i] d = bisect.bisect_left(X, a) if d < N and X[d] == a: to[d].append(i) a = X[i] - A[i] d = bisect.bisect_left(X, a) if d < N and X[d] == a: to[d].append(i) p = [0] * N for i in range(N): p[i] = [X[i] + A[i], i] p = sorted(p, reverse=True) ans = [0] * N for i in range(N): a = p[i][0] b = p[i][1] if ans[b] != 0: continue q = [b] while q: t = q.pop() ans[t] = a - X[t] for x in to[t]: if ans[x] == 0: q.append(x) for i in range(N): print(ans[i])