#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  stack<int> a, a1;
  stack<int> b, b1;
  map<int, int> M;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int c;
    cin >> c;
    a.push(c);
  }
  for (int i = 0; i < n; i++) {
    int c;
    cin >> c;
    b.push(c);
  }
  for (int i = 0; i < n; i++) {
    int c = a.top();
    a.pop();
    a1.push(c);
    int d = b.top();
    b.pop();
    b1.push(d);
  }
  int i = 0;
  while (!b1.empty()) {
    if (M[b1.top()] == 1) {
      cout << "0"
           << " ";
      b1.pop();
    } else {
      int k = 0, found = 0;
      while (!a1.empty()) {
        if (b1.top() == a1.top()) {
          k++;
          b1.pop();
          M.insert(pair<int, int>(a1.top(), 1));
          a1.pop();
          found = 1;
          break;
        }
        k++;
        M.insert(pair<int, int>(a1.top(), 1));
        a1.pop();
      }
      if (found == 1) cout << k << " ";
    }
  }
  return 0;
}
