Robi is the greatest technician who ever lived. He came to visit his friend Aritro's house, where Aritro was proudly showing off his new Wi-Fi connection. Robi also wanted to test it, but asking Aritro for the Wi-Fi password would be far too ordinary for a technician of his caliber. Using his special software, Robi found the password; however, he still had to solve the puzzle given by the system to access it.
Robi has discovered two arrays of $$$n$$$ integers, $$$A$$$ and $$$B$$$. You can perform the following operation at most once:
For two arrays $$$A$$$ and $$$B$$$ of the same length, define
$$$$$$F(A, B) = \min|\text{MEX}(A) - \text{MEX}(B)|$$$$$$
where the minimum is taken over all possible ways of performing the operation above, including not performing any swap. In other words, $$$F(A, B)$$$ is the smallest possible gap between the two $$$\text{MEX}$$$ values that you can achieve by performing at most one swap.
Robi must compute, for every prefix length from $$$1$$$ to $$$n$$$, the value $$$F$$$ for that prefix. That is, for each $$$k$$$ ($$$1 \le k \le n$$$), he needs to do the following:
$$$$$$F\big(A[0 \dots k-1],\; B[0 \dots k-1]\big).$$$$$$
In other words, he must compute the function for every prefix of the arrays. For each prefix, the difference between the two $$$\text{MEX}$$$ values must be minimized.
Each prefix is evaluated independently; a swap performed for one prefix does not affect any other prefix.
Help Robi solve the puzzle!
Constraints
Subtasks
| Subtask | Points | Add. constraints |
| $$$1$$$ | $$$5$$$ | $$$n=10, A[i]=B[i]$$$ |
| $$$2$$$ | $$$15$$$ | $$$A[i]$$$ is even |
| $$$3$$$ | $$$15$$$ | $$$ n \le 1000$$$ |
| $$$4$$$ | $$$20$$$ | $$$ n \le 5000$$$ |
| $$$5$$$ | $$$45$$$ | No additional constraints |
5 0 1 2 3 4 0 1 1 2 3
0 0 1 1 1
4 0 4 2 2 1 1 0 2
1 1 1 0
$$$\text{MEX}(A)$$$ is defined as the smallest non-negative integer that is not present in the array. For example, $$$\text{MEX}([1,2,0,5])$$$ is $$$3$$$, and $$$\text{MEX}([1,2,4,9])$$$ is $$$0$$$.
In the second example, for every index $$$i$$$, we compute as follows:
| Name |
|---|


