import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int[] points = new int[n]; for (int i = 0; i < n; i++) { points[i] = sc.nextInt(); } HashMap> relays = new HashMap<>(); PriorityQueue queue = new PriorityQueue<>(); for (int i = 0; i < n; i++) { int x = sc.nextInt(); if (!relays.containsKey(points[i] - x)) { relays.put(points[i] - x, new ArrayList<>()); } relays.get(points[i] - x).add(i); if (!relays.containsKey(points[i] + x)) { relays.put(points[i] + x, new ArrayList<>()); } relays.get(points[i] + x).add(i); queue.add(new Path(i, points[i] + x)); } int[] ans = new int[n]; while (queue.size() > 0) { Path p = queue.poll(); if (ans[p.idx] > 0) { continue; } ans[p.idx] = p.value - points[p.idx]; if (relays.containsKey(points[p.idx])) { for (int x : relays.get(points[p.idx])) { if (ans[x] == 0) { queue.add(new Path(x, p.value)); } } } } System.out.println(String.join("\n", Arrays.stream(ans).mapToObj(String::valueOf).toArray(String[]::new))); } static class Path implements Comparable { int idx; int value; public Path(int idx, int value) { this.idx = idx; this.value = value; } public int compareTo(Path another) { return another.value - value; } } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }