N = gets.to_i X = gets.split.map(&:to_i) A = gets.split.map(&:to_i) E = Hash.new { |h, k| h[k] = [] } max_v = Hash.new(0) N.times do |i| x = X[i] a = A[i] E[x - a] << x E[x + a] << x end visited = Hash.new(false) E.keys.sort.reverse_each do |cv| queue = [] queue << cv until queue.empty? v = queue.shift next if visited[v] visited[v] = true max_v[v] = cv if max_v[v] < cv E[v].each do |u| queue << u end end end puts X.map { |x| max_v[x] - x }