#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> b(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long j = 0; j < n; j++) cin >> b[j];
  vector<long long> an(n + 1, -1);
  long long j = 0;
  for (long long i = 0; i < n && j < n; i++) {
    if (an[b[i]] == -1) {
      int c = 1;
      while (j < n && b[i] != a[j]) {
        an[a[j]] = 0;
        j++;
        c++;
      }
      if (j != n) {
        an[b[i]] = c;
        j++;
      } else
        break;
    }
  }
  for (long long i = 0; i < n; i++) cout << an[b[i]] << " ";
  return 0;
}
