#include <bits/stdc++.h>
using namespace std;
queue<int> s;
int a[200010];
int b[200010];
int main() {
  int n;
  scanf("%d", &n);
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    a[t]++;
    s.push(t);
  }
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    if (a[t] == 0) {
      b[i] = 0;
      continue;
    }
    int x = s.front();
    s.pop();
    b[i] = 1;
    a[x] = 0;
    while (x != t) {
      b[i]++;
      x = s.front();
      s.pop();
      a[x] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", b[i]);
  }
  printf("\n");
  return 0;
}
