#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, x, cnt = 0, last = 1;
  cin >> n;
  vector<int> stak(n), bag;
  map<int, int> mp;
  for (int i = 0; i < n; i++) cin >> stak[i], mp[stak[i]]++;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (mp[x] == 0) {
      cout << 0 << " ";
      continue;
    }
    if (stak[cnt] == x)
      cout << 1 << " ", mp[x] = 0, cnt++;
    else {
      while (1) {
        mp[stak[cnt]] = 0;
        cnt++, last++;
        if (stak[cnt] == x) {
          cout << last << " ", mp[stak[cnt]] = 0, cnt++;
          break;
        }
      }
    }
    last = 1;
  }
  return 0;
}
