#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using pii = pair<int, int>;
using mii = map<int, int>;
const long long upper = 2e5 + 20;
const long long M = (long long)1e9 + 7;
const long long inf = (long long)1e17;
const double eps = 1e-8;
signed main() {
  long long begtime = clock();
  ;
  cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long cur = 1;
  vb done(n + 1, false);
  long long a[n + 1], b[n + 1];
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long j = 1; j <= n; j++) cin >> b[j];
  vi ans;
  for (long long step = 1; step <= n; step += 1) {
    if (done[b[step]]) {
      ans.push_back(0);
      continue;
    }
    stack<long long> s;
    while (true) {
      s.push(a[cur]);
      done[a[cur]] = true;
      cur += 1;
      if (a[cur - 1] == b[step]) break;
    }
    ans.push_back(s.size());
  }
  for (auto v : ans) cout << v << ' ';
  long long endtime = clock();
  cerr << '\n'
       << "Time elapsed: " << (endtime - begtime) * 1000 / CLOCKS_PER_SEC
       << " ms";
  return 0;
}
