#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int index[n + 1];
  for (int i = 0; i < n; i++) {
    index[a[i]] = i;
  }
  unordered_map<int, bool> mp;
  for (int i = 0; i < n; i++) {
    mp[a[i]] = true;
  }
  int rem = n, prev = 0;
  for (int i = 0; i < n; i++) {
    int g = max(prev, index[b[i]] + 1);
    rem -= (g - prev);
    if (mp.find(b[i]) == mp.end())
      cout << "0 ";
    else if (a[i] == b[i])
      cout << "1 ";
    else {
      int gg = g - prev, gi = g;
      while (gg--) {
        mp.erase(a[gi - 1]);
        gi -= 1;
      }
      cout << (g - prev) << " ";
    }
    prev = g;
  }
  return 0;
}
