#include using namespace std; bitset <100000> a, b; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int L, M, N, Q, t; cin >> L >> M >> N; for (int i = 0; i < L; i++) { cin >> t; t -= 1; a.set(t, true); } for (int i = 0; i < M; i++) { cin >> t; t -= 1; b.set(t, true); } cin >> Q; for (int i = 0; i < Q; i++) { bitset <100000> temp = a & b; cout << temp.count() << '\n'; b <<= 1; } return 0; }