The Frog Regent has arranged his
A frog is considered to have made a single leap if it has jumped over the frog in front of it, swapping
places with it in the process. For example, if the frogs are sequenced as
The Frog Regent wishes, using some number of proclamations, to rearrange the frogs from the starting sequence to his favourite resulting sequence. Given the starting and resulting frog sequences, write a program that will compute a sequence of proclamations needed for the Regent to rearrange the frogs into the resulting sequence. Naturally, the starting and resulting sequences will not be equal.
Input Specification
The first line of input contains a positive integer
The second line of input contains a permutation of the first
The third line of input contains another permutation of the first
Test cases worth
Output Specification
Output any sequence of integers (one integer per line) that the Frog Regent can proclaim in order to rearrange the frogs into the resulting sequence.
The number of proclamations must not exceed
Note: The test data will ensure that a solution will always exist.
Sample Input 1
6
1 5 4 3 2 6
1 2 5 4 3 6
Sample Output 1
2
Sample Input 2
5
1 5 3 2 4
1 5 4 2 3
Sample Output 2
5
3
5
2
Comments