n = int(input()) X = list(map(int, input().split())) Y = list(map(int, input().split())) ans = 10**18 id = -1 for i in range(n): x = X[i] y = Y[i] if ans >= x+y: xm, ym = x, y ans = x+y print(ans) print(0) for i in range(n): x = X[i] y = Y[i] if x >= ans and y >= ans: print(ans) elif x >= ans and y < ans: print(ans) elif x < ans and y >= ans: print(0) else: if x <= xm: print(x) else: print(ans-y) print(ans)