#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int a[300000], b[300000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int i, j, k, pre = 0;
  unordered_map<int, int> v;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    v[a[i]] = i + 1;
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  int ans = 0;
  for (i = 0; i < n; i++) {
    if (i == 0) {
      j = v[b[i]];
      ans = j;
    } else if (i != 0 && max(v[b[i]], j) == v[b[i]]) {
      k = v[b[i]];
      v[b[i]] -= j;
      j = k;
      ans = v[b[i]];
    } else {
      cout << "0 ";
      continue;
    }
    cout << ans << " ";
  }
  return 0;
}
