from collections import defaultdict import heapq n = int(input()) x = list(map(int,input().split())) a = list(map(int,input().split())) d = defaultdict(list) for i in range(n): d[x[i] + a[i]].append(i) d[x[i] - a[i]].append(i) hq = [(-x[i]-a[i], i) for i in range(n)] heapq.heapify(hq) dist = [-1] * n while hq: l,now = heapq.heappop(hq) l = -l if dist[now] != -1: continue dist[now] = l for nxt in d[x[now]]: if dist[nxt] != -1:continue heapq.heappush(hq,(-l,nxt)) for i in range(n): print(dist[i] - x[i])