#include <bits/stdc++.h>
using namespace std;
const int mx = 200 * 1000 + 5;
bool vis[mx];
int arr[mx];
int main() {
  int n, i, j, k, p, q;
  scanf("%d", &n);
  stack<int> ss;
  for (i = 0; i < n; i++) {
    scanf("%d", arr + i);
  }
  for (i = n - 1; i >= 0; i--) ss.push(arr[i]);
  for (i = 0; i < n; i++) {
    if (i) printf(" ");
    scanf("%d", &p);
    if (vis[p]) {
      printf("0");
      continue;
    }
    k = 0;
    while (!ss.empty()) {
      j = ss.top();
      ss.pop();
      k++;
      vis[j] = 1;
      if (j == p) break;
    }
    printf("%d", k);
  }
  return 0;
}
