from collections import deque N = int(input()) X = list(map(int, input().split())) A = list(map(int, input().split())) S = set(X) E = [[] for _ in range(N)] T = [] # 落ちた場所と落とした人を記録 dic = dict(zip(X, range(N))) for i, x in enumerate(X): a = A[i] if x + a in S: E[dic[x + a]].append(i) else: T.append((x + a, i)) if x - a in S: E[dic[x - a]].append(i) #print(E) #print(T) T.sort(key = lambda x:-x[0]) RP = [-1] * N # 到達ポジション visited = [0] * N for rpos, i in T: RP[i] = max(RP[i], rpos) #visited = [0] * N q = deque() q.append(i) visited[i] = 1 while len(q) > 0: u = q.pop() for v in E[u]: if visited[v] == 0: visited[v] = 1 RP[v] = max(RP[v], rpos) q.append(v) for i in range(N): print(RP[i] - X[i])