import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio, std.bitmanip; void main() { auto s = readln.split.map!(to!int); auto L = s[0]; auto M = s[0]; auto N = s[0]; auto AN = readln.split.map!(to!int); auto BN = readln.split.map!(to!int); BitArray A, B; A.length = B.length = 10^^5+1; foreach (a; AN) A[a] = true; foreach (b; BN) B[b] = true; auto Q = readln.chomp.to!int; foreach (i; 0..Q) { (A&B).bitsSet.array.length.writeln; B <<= 1; } }