#!/usr/bin/env python3
# NOTE: it is recommended to use this even if you don't understand the following code.


# input data
N, M, Q = map(int, input().strip().split())
S = list(map(int, input().strip().split()))
T = list(map(int, input().strip().split()))
A, B, C, D = [0] * Q, [0] * Q, [0] * Q, [0] * Q
for q in range(Q):
    A[q], B[q], C[q], D[q] = map(int, input().strip().split())

# insert your code here

for q in range(Q):
    print(42)  # print the result to each query
