There are members of SCSC standing in a line. Their heights are all distinct. The height rank of the member at position from the left is . The shortest member has rank , and the tallest has rank .
A member currently remaining in the line is called a most ordinary member if both conditions below hold.
Repeatedly choose one most ordinary member and remove them from the line until no such member exists. Removing a member preserves the relative order of all other members. If several members satisfy the conditions, you may choose any one of them. The process also ends if the line becomes empty.
You are given queries. Query swaps the members currently at positions and . After each query, find the maximum number of members that can be removed by the process above.
Swaps are cumulative, but the removals used to compute an answer do not change the actual line. Thus, the line always contains members when a query is performed.
The input is given in the following format:
For each query, print the maximum number of members that can be removed after that query, one answer per line in query order.
After the first query, the height ranks are . Removing the member with height rank leaves no member that can be removed.
After the second query, there is no most ordinary member. After the fourth query, the original line is restored, and all members can be removed in the order of height ranks .