class UnionFind: def __init__(self, n): self.data = [-1] * (n + 1) def root(self, a: int) -> int: if self.data[a] < 0: return a self.data[a] = self.root(self.data[a]) return self.data[a] def unite(self, a: int, b: int) -> bool: pa = self.root(a) pb = self.root(b) if pa == pb: return False if self.data[pa] > self.data[pb]: pa, pb = pb, pa self.data[pa] += self.data[pb] # pa を pb をつなげる self.data[pb] = pa return True def issame(self, a: int, b: int) -> bool: return self.root(a) == self.root(b) def size(self, a: int) -> int: """a が属する集合のサイズ""" return -self.data[self.root(a)] N = int(input()) X = list(map(int, input().split())) A = list(map(int, input().split())) x2i = {} for i in range(N): x2i[X[i]] = i uf = UnionFind(N) for i, a in enumerate(A): for s in (1, -1): x = X[i] + a * s if x in x2i: j = x2i[x] uf.unite(i, j) m = {i: X[i] + A[i] for i in range(N)} for i in range(N): root = uf.root(i) m[root] = max(m[root], X[i] + A[i]) for i in range(N): print(m[uf.root(i)] - X[i])