#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 19;
int stk[N], top, vis[N];
int pop(int x) {
  if (vis[x]) return 0;
  int ans = 0;
  while (stk[top] != x) {
    vis[stk[top]] = 1;
    ++ans;
    --top;
  }
  vis[x] = 1;
  ++ans;
  --top;
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    stk[++top] = x;
  }
  reverse(stk + 1, stk + n + 1);
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    cout << pop(x) << ' ';
  }
  cout << endl;
  return 0;
}
