#P1073B. Vasya and Books
Vasya and Books
Description
Vasya has got books, numbered from to , arranged in a stack. The topmost book has number , the next one — , and so on. The book at the bottom of the stack has number . All numbers are distinct.
Vasya wants to move all the books to his backpack in steps. During -th step he wants to move the book number into his backpack. If the book with number is in the stack, he takes this book and all the books above the book , and puts them into the backpack; otherwise he does nothing and begins the next step. For example, if books are arranged in the order (book is the topmost), and Vasya moves the books in the order , then during the first step he will move two books ( and ), during the second step he will do nothing (since book is already in the backpack), and during the third step — one book (the book number ). Note that are distinct.
Help Vasya! Tell him the number of books he will put into his backpack during each step.
The first line contains one integer — the number of books in the stack.
The second line contains integers denoting the stack of books.
The third line contains integers denoting the steps Vasya is going to perform.
All numbers are distinct, the same goes for .
Print integers. The -th of them should be equal to the number of books Vasya moves to his backpack during the -th step.
Input
The first line contains one integer — the number of books in the stack.
The second line contains integers denoting the stack of books.
The third line contains integers denoting the steps Vasya is going to perform.
All numbers are distinct, the same goes for .
Output
Print integers. The -th of them should be equal to the number of books Vasya moves to his backpack during the -th step.
Note
The first example is described in the statement.
In the second example, during the first step Vasya will move the books . After that only books and remain in the stack ( is above ). During the second step Vasya will take the books and . After that the stack becomes empty, so during next steps Vasya won't move any books.