def mDistance(a, b):
    axisDist = [abs(x - y) for x, y in zip(a, b)]
    return(sum(axisDist))


N, M = map(int, input().split())
An, Am = ([], [])

while len(An) < N:
    An.append(map(int, input().split()))

while len(Am) < M:
    Am.append(map(int, input().split()))

for a in An:
    B = map(lambda b: mDistance(a, b), Am)
    I, _ = min(enumerate(list(B)), key=lambda b: b[1])
    print(I + 1)