#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int numOfBooks;
  int books[numOfBooks];
  map<int, bool> hasBeenPicked;
  cin >> numOfBooks;
  for (int i = 0; i < numOfBooks; i++) {
    cin >> books[i];
  }
  int pickArrangement[numOfBooks];
  for (int i = 0; i < numOfBooks; i++) {
    cin >> pickArrangement[i];
  }
  int indexBook = 0;
  for (int i = 0; i < numOfBooks; i++) {
    int pick = pickArrangement[i];
    int numPicked = 0;
    bool isPicked = hasBeenPicked.find(pick) != hasBeenPicked.end();
    while (!isPicked) {
      int bookPicked = books[indexBook];
      indexBook++;
      hasBeenPicked[bookPicked] = true;
      if (bookPicked == pick) {
        hasBeenPicked[pick] = true;
        isPicked = hasBeenPicked[pick];
      }
      numPicked += 1;
    }
    if (i < numOfBooks - 1) {
      cout << numPicked << " ";
    } else {
      cout << numPicked << '\n';
    }
  }
  return 0;
}
