#include #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n; scanf("%d",&n); vector a(n),b(n); rep(i,n) scanf("%d",&a[i]), a[i]--; rep(i,n) scanf("%d",&b[i]), b[i]--; vector pos(n); rep(i,n) pos[b[i]]=i; int mn=n; vector ans; for(int i=n-1;i>=0;i--){ if(pos[a[i]]