N, M, L, K = map(int, input().split()) assert(1 <= N and N <= 2 * 100000) assert(0 <= M and M <= min(N - 1, 100000)) assert(0 <= L and L <= min((N + 1) * (N + 1), 100)) assert(0 <= K and K <= 100000) for _ in range(M): x, y = map(int, input().split()) assert(0 < x and x < N) assert(0 < y and y < N) for _ in range(L): x, y = map(int, input().split()) assert(0 <= x and x <= N) assert(0 <= y and y <= N)