#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
int n, flag[MAXN], a[MAXN];
stack<int> s;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[i] = x;
  }
  for (int i = n; i >= 1; i--) s.push(a[i]), flag[a[i]] = 1;
  for (int o = 1; o <= n; o++) {
    int x, ans = 0;
    scanf("%d", &x);
    if (flag[x] == 0)
      printf("0 ");
    else {
      while (s.top() != x) {
        flag[s.top()] = 0;
        s.pop();
        ans++;
      }
      flag[x] = 0;
      s.pop();
      ans++;
      printf("%d ", ans);
    }
  }
  return 0;
}
