Vasya has got $n$ books, numbered from $1$ to $n$, arranged in a stack. The topmost book has number $a_1$, the next one — $a_2$, and so on. The book at the bottom of the stack has number $a_n$. All numbers are distinct.

Vasya wants to move all the books to his backpack in $n$ steps. During $i$-th step he wants to move the book number $b_i$ into his backpack. If the book with number $b_i$ is in the stack, he takes this book and all the books above the book $b_i$, and puts them into the backpack; otherwise he does nothing and begins the next step. For example, if books are arranged in the order $[1, 2, 3]$ (book $1$ is the topmost), and Vasya moves the books in the order $[2, 1, 3]$, then during the first step he will move two books ($1$ and $2$), during the second step he will do nothing (since book $1$ is already in the backpack), and during the third step — one book (the book number $3$). Note that $b_1, b_2, \dots, b_n$ are distinct.

Help Vasya! Tell him the number of books he will put into his backpack during each step.


-----Input-----

The first line contains one integer $n~(1 \le n \le 2 \cdot 10^5)$ — the number of books in the stack.

The second line contains $n$ integers $a_1, a_2, \dots, a_n~(1 \le a_i \le n)$ denoting the stack of books.

The third line contains $n$ integers $b_1, b_2, \dots, b_n~(1 \le b_i \le n)$ denoting the steps Vasya is going to perform.

All numbers $a_1 \dots a_n$ are distinct, the same goes for $b_1 \dots b_n$.


-----Output-----

Print $n$ integers. The $i$-th of them should be equal to the number of books Vasya moves to his backpack during the $i$-th step.


-----Examples-----
Input
3
1 2 3
2 1 3

Output
2 0 1 

Input
5
3 1 4 2 5
4 5 1 3 2

Output
3 2 0 0 0 

Input
6
6 5 4 3 2 1
6 5 3 4 2 1

Output
1 1 2 0 1 1 



-----Note-----

The first example is described in the statement.

In the second example, during the first step Vasya will move the books $[3, 1, 4]$. After that only books $2$ and $5$ remain in the stack ($2$ is above $5$). During the second step Vasya will take the books $2$ and $5$. After that the stack becomes empty, so during next steps Vasya won't move any books.

Difficulty: interview

Starter code:

Solutions:
n = int(input())
a = list(map(int, input().split()))[::-1]
b = list(map(int, input().split()))
ans = [0] * n
marked = [True] * (n + 1)
for i in range(n):
    if marked[b[i]]:
        while True:
            marked[a[-1]] = False
            ans[i] += 1
            if a[-1] == b[i]:
                a.pop()
                break
            a.pop()
    else:
        continue
print(*ans)

def ii():
    return int(input())
def mi():
    return map(int, input().split())
def li():
    return list(mi())

n = ii()
a = li()
b = li()

done = set()
j = 0
ans = []
for i in range(n):
    if b[i] in done:
        ans.append(0)
    else:
        c = 0
        while a[j] != b[i]:
            done.add(a[j])
            j += 1
            c += 1
        done.add(a[j])
        j += 1
        ans.append(c + 1)
print(*ans)

n = int(input())
ai = list(map(int,input().split())) 
bi = list(map(int,input().split()))
ai2 = [0] * (n+1)
n2 = 0
for i in range(n):
    num = 0
    if ai2[bi[i]] != 1:
        for j in range(n2,n):
            ai2[ai[j]] = 1
            if ai[j] == bi[i]:
                num = j + 1 - n2
                n2 = j + 1
                break
    print(num,end=" ")

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ha={}
for i in range(n):
    ha[a[i]]=i
removed=0
out=""
for i in range(n):
    if ha[b[i]]<removed:
        out+="0 "
    else:
        out+=str(ha[b[i]]-removed+1)+" "
        removed=ha[b[i]]+1
print(out[:-1])

n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))



REVA=[None]*(n+1)

for i in range(n):
    REVA[A[i]]=i+1

top=0
ANSLIST=[]

for b in B:
    if REVA[b]>top:
        ANSLIST.append(REVA[b]-top)
        top=REVA[b]
    else:
        ANSLIST.append(0)

for ans in ANSLIST:
    print(ans,end=" ")

    


def main():
    n = int(input())

    arr = list(map(int, input().split()))
    numb = [0 for i in range(n + 1)]
    for i in range(len(arr)):
        numb[arr[i]] = i + 1

    brr = list(map(int, input().split()))
    ind = 0
    for c in brr:
        total = 0
        num = numb[c]
        if num > ind:
            total = num - ind
            ind = num
        print(total, end=' ')

main()


def main():
    n = int(input())
    a = list([int(x) for x in input().split(" ")])
    b = list([int(x) for x in input().split(" ")])
    now = 0
    ans = []
    h = set()
    for i in range(n):
        count = 0
        while b[i] not in h:
            h.add(a[now])
            now += 1
            count += 1
        ans.append(str(count))
    print(" ".join(ans))


def __starting_point():
    main()

__starting_point()

# Author:      Divesh Uttamchandani
# Institution: BITS Pilani
n = int(input().strip())
a = list(map(int,input().strip().split()))
b = list(map(int,input().strip().split()))
pos_of = [-1 for i in range(2*10**5+1)]

for i,ele in enumerate(a):
    pos_of[ele]=i+1

current_pos = 0
ans=[]
for i in b:
    if(pos_of[i]>current_pos):
        ans.append(pos_of[i]-current_pos)
        current_pos=pos_of[i]
    else:
        ans.append(0)

print(' '.join(list(map(str,ans))))
# <> with <3 using Termicoder:
# https://termicoder.github.io


n = int(input())
a = input().split()
d = {}
k = 0
for i in range(len(a)):
    d[a[i]] = i
for s in input().split():
    if d[s] != -1:
        c = d[s]
        print(c - k + 1, end=' ')
        for i in range(k, c + 1):
            d[a[i]] = -1
        k = c + 1
    else:
        print(0, end=' ')
    #print(d)
    #print(a)


n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=a[::-1]
c=[0]*n
bk=[]
for i in range(n):
    co=0
    if c[b[i]-1]==0:
        while a[-1]!=b[i]:
            co+=1
            c[a[-1]-1]=1
            a.pop()
        co+=1
        c[a[-1]-1]=1
        a.pop()
    bk.append(co)
print(*bk)
                


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_per = n * [0]
for i in range(n):
    a_per[a[i] - 1] = i

cur_moved = -1
for i in range(n):
    print(max(a_per[b[i] - 1] - cur_moved, 0), end = " ")
    cur_moved = max(cur_moved, a_per[b[i] - 1])


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = set()
t = 0
i = 0
for j in range(n):
    if b[j] in s:
        print(0, end=' ')
    else:
        while a[i] != b[j]:
            s.add(a[i])
            t += 1
            i += 1
        t += 1
        s.add(a[i])
        i += 1
        print(t, end=' ')
        t = 0


n = int(input())
ids = list(map(int, input().split()))
ids.reverse()
seq = list(map(int, input().split()))
used = [0 for i in range(n + 1)]
result = []
for op in seq:
    if used[op]:
        result.append(0)
        continue
    cnt = 0
    while seq:
        cur = ids[-1]
        cnt += 1
        used[cur] = 1
        ids.pop()
        if cur == op:
            break
    result.append(cnt)
print(*result)


n = int(input())
a = input().split()
c = []
d = set()
for i in range(n):
    c.append(int(a[i]))
b = input().split()
index = 0
count = 0
stri = ""
for i in range(n):
    if int(b[i]) not in d:
        while c[index] != int(b[i]):
            d.add(c[index])
            index += 1
            count += 1
        d.add(c[index])
        index += 1
        count += 1
    if i == n-1:
        stri += str(count)
    else:
        stri += str(count)+" "
    count = 0
print(stri)


n = int(input())
a_trans = [n + 1] * (n + 1)
i = 1
for ai in input().split():
	a_trans[int(ai)] = i
	i += 1
min_unt_ake_n = 1
res = []
for bi in input().split():
	atb_i = a_trans[int(bi)]
	if atb_i < min_unt_ake_n:
		res.append('0')
	else:
		nex = atb_i + 1
		res.append(nex - min_unt_ake_n)
		min_unt_ake_n = nex
print(*res)


n=int(input())
a=[int(s) for s in input().split()]
id=[0]*(n+1)
for i in range(n):
    id[a[i]]=i+1
b=[int(s) for s in input().split()]
max=0
for i in b:
    if id[i]>max:
        print(id[i]-max,end=' ')
        max=id[i]
    else:
        print(0,end=' ')

n = int(input())
books = [int(x) for x in input().split(' ')]
steps = [int(x) for x in input().split(' ')]

furthest_move = 0
d = {}
for i in range(n):
	d[books[i]] = i + 1
res = ""
for i in range(n):
	if d[steps[i]] > furthest_move:
		res += str(d[steps[i]] - furthest_move) + " "
		furthest_move = d[steps[i]]
	else:
		res += "0 "

print(res.strip())


n = int(input())

a = list(map(int,input().strip().split()))
b = list(map(int,input().strip().split()))

mp = {}

f = 0
for i in range(n):
    mp[a[i]]=i+1

ans = []
for i in range(n):
    if mp[b[i]]>f:
        ans.append(mp[b[i]]-f)
        f = mp[b[i]]
    else:
        ans.append(0)

print(*ans)        


from collections import defaultdict
def main():
    n = int(input())
    shelf = map(int, input().split())
    oper = map(int, input().split())
    d = defaultdict(int)
    for i, book in enumerate(shelf, 1):
        d[book] = i

    top = 1
    for cur in oper:
        remIndex = d[cur]
        ans = remIndex - top + 1
        if ans <= 0:
            print("0",end=" ")
        else:
            print(ans,end=" ")
            top = remIndex + 1


main()

n = int(input())
a = list(map(int, input().split()))
a.reverse()
b = list(map(int, input().split()))

u = set()

for i in range(n):
    c = 0
    if not (b[i] in u):
        while a[-1] != b[i]:
            u.add(a[-1])
            a.pop()
            c += 1
        u.add(a[-1])
        a.pop()
        c += 1        
    print(c, end = ' ')

n = int(input())

a = [int(s) for s in input().split()]
x = [int(s) for s in input().split()]

c = [0]*(n+1)
for i in range(n):
    c[a[i]] = i+1

mx = 0

for i in x:
    if c[i]>mx:
        print(c[i] - mx, end=' ')
        mx = c[i]
    else:
        print(0, end=' ')

n=int(input())
d={}
a=list(map(int,input().split(' ')))
b=list(map(int,input().split(' ')))
for i in range(n):
    d[a[i]]=i
c=d[b[0]]
print(c+1,end=' ')
for i in range(1,n):
    if d[b[i]]<c:
        print(0,end=' ')
    else:
        print(d[b[i]]-c,end=' ')
        c=d[b[i]]
    


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
isi = [0] * n
d = {}
head = n
for i in range(len(b)):
	d[a[i]] = i 
res = []
head = 0
for i in range(n):
	if isi[b[i] - 1] == 0:
		ind = d[b[i]]
		kol = 0
		for j in range(head, ind + 1):
			isi[a[j] - 1] = 1
			kol += 1
		res.append(kol)
		head = ind + 1
	else:
		res.append(0)
for c in res:
	print(c, end = ' ')


n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = [0] * n
t = 1
for i in A:
    C[i - 1] = t
    t += 1
t = 0
for i in B:
    if C[i - 1] > t:
        print(C[i - 1] - t, end = ' ')
        t = C[i - 1] 
    else:
        print(0, end = ' ')
print()