#define _USE_MATH_DEFINES #include #include #include #include #include //#include #include #include #include #include #include #include ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)< ///////// typedef long long LL; typedef long double LD; ///////// using namespace::std; ///////// const int nmax = 100000; vector A; vector B; vector v; int main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;// //cout << setprecision(16);// int L,M,N; cin>>L>>M>>N; A.resize(L); rep(i,L){ cin>>A[i]; } B.resize(M); rep(i,M){ cin>>B[i]; } v.resize(L+M); sort(A.begin(),A.end()); sort(B.begin(),B.end()); vector::iterator it; int Q; cin>>Q; rep(i,Q){ it = set_intersection( A.begin(), A.end(), B.begin(), B.end(), v.begin() ); cout << it - v.begin() << '\n'; rep(i,M){ ++B[i]; } } return 0; }