{"raw_statement":[{"iden":"problem statement","content":"Define the **cost** of a sequence $X$ as (the maximum value of $X$ minus the minimum value of $X$).\nYou are given sequences $A = (A_1, \\ldots, A_N)$ and $B = (B_1, \\ldots, B_N)$ of length $N$. Solve the following problem for $k = 1, 2, \\ldots, N$.\n\n*   Find the minimum possible cost of the sequence $C = (C_1, \\ldots, C_k)$ whose $i$\\-th element $C_i$ is $A_i$ or $B_i$."},{"iden":"constraints","content":"*   All input numbers are integers.\n*   $1 \\leq N \\leq 5 \\times 10^5$\n*   $1 \\leq A_i, B_i \\leq 10^9$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ \n$A_1$ $\\ldots$ $A_N$\n$B_1$ $\\ldots$ $B_N$"},{"iden":"sample input 1","content":"3\n8 11 10\n7 6 1"},{"iden":"sample output 1","content":"0\n1\n3\n\nFor $k=1$, if we choose $C = (8)$, the cost of $C$ is $0$, which is the minimum.\nFor $k=2$, if we choose $C = (7,6)$, the cost of $C$ is $1$, which is the minimum.\nFor $k=3$, if we choose $C = (8,11,10)$, the cost of $C$ is $3$, which is the minimum."},{"iden":"sample input 2","content":"10\n43 35 36 58 25 7 61 4 96 3\n55 29 88 15 99 49 67 57 92 49"},{"iden":"sample output 2","content":"0\n8\n8\n23\n28\n33\n36\n36\n64\n64"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}