from collections import * def bfs(G, s, N): Q = deque([s]) while Q: u = Q.popleft() for v in G[u]: if seen[v] != -1: continue seen[v] = seen[u] Q.append(v) return seen N = int(input()) X = list(map(int, input().split())) A = list(map(int, input().split())) G = [[] for i in range(N)] D = defaultdict(int) for i in range(N): D[X[i]] = i for i in range(N): if X[i] + A[i] in D: G[D[X[i] + A[i]]].append(i) if X[i] - A[i] in D: G[D[X[i] - A[i]]].append(i) seen = [-1] * N L = [] for i in range(N): L.append((X[i] + A[i], i)) L.sort(reverse=True) for d, i in L: if seen[i] != -1: continue seen[i] = d bfs(G, i, N) for i in range(N): print(seen[i] - X[i])