from heapq import heapify, heappop, heappush from collections import defaultdict 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) Heap = [(-X[i] - A[i], i) for i in range(n)] heapify(Heap) Dist = [-1 for _ in range(n)] while Heap: l, curr = heappop(Heap) l *= -1 if Dist[curr] != -1: continue Dist[curr] = l for np in D[X[curr]]: if Dist[np] != -1: continue heappush(Heap, (-l, np)) for i in range(n): print(Dist[i] - X[i])