There are N students and M checkpoints on the xy-plane.

The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j).

When the teacher gives a signal, each student has to go to the nearest checkpoint measured in Manhattan distance. 

The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.

Here, |x| denotes the absolute value of x.

If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.

Which checkpoint will each student go to?

-----Constraints-----
 - 1 \leq N,M \leq 50
 - -10^8 \leq a_i,b_i,c_j,d_j \leq 10^8
 - All input values are integers.

-----Input-----
The input is given from Standard Input in the following format:
N M
a_1 b_1
:  
a_N b_N
c_1 d_1
:  
c_M d_M

-----Output-----
Print N lines.

The i-th line (1 \leq i \leq N) should contain the index of the checkpoint for the i-th student to go.

-----Sample Input-----
2 2
2 0
0 0
-1 0
1 0

-----Sample Output-----
2
1

The Manhattan distance between the first student and each checkpoint is:
 - For checkpoint 1: |2-(-1)|+|0-0|=3
 - For checkpoint 2: |2-1|+|0-0|=1
The nearest checkpoint is checkpoint 2. Thus, the first line in the output should contain 2.
The Manhattan distance between the second student and each checkpoint is:
 - For checkpoint 1: |0-(-1)|+|0-0|=1
 - For checkpoint 2: |0-1|+|0-0|=1
When there are multiple nearest checkpoints, the student will go to the checkpoint with the smallest index. Thus, the second line in the output should contain 1.

Difficulty: introductory

Starter code:

Solutions:
n,m=list(map(int,input().split()))
ab=[[int(x) for x in input().split()] for _ in range(n)]
cd=[[int(x) for x in input().split()] for _ in range(m)]

for a,b in ab:
  ans=list()
  for c,d in cd:
    ans.append(abs(a-c)+abs(b-d))
  print((ans.index(min(ans))+1))


n,m = map(int, input().split())
num_list = []
for i in range(n):
  num_list.append(list(map(int,input().split())))
check_list = []
for i in range(m):
  check_list.append(list(map(int,input().split())))

for i in range(n):
  d = 10**9
  h = 0
  for j in range(m):
    if d > (abs(num_list[i][0]-check_list[j][0])+abs(num_list[i][1]-check_list[j][1])):
      d = abs(num_list[i][0]-check_list[j][0])+abs(num_list[i][1]-check_list[j][1])
      h = j+1
  print(h)

N, M = map(int, input().split())
ab = []
for _ in range(N):
    ab.append(list(map(int, input().split())))
cd = []
for _ in range(M):
    cd.append(list(map(int, input().split())))
    
for x in ab:
    a = x[0]
    b = x[1]
    cnt = []
    for y in cd:
        c = y[0]
        d = y[1]
        k = abs(a-c)+abs(b-d)
        cnt.append(k)
    print(cnt.index(min(cnt))+1)

n,m=map(int,input().split())
ab=[[int(x) for x in input().split()] for _ in range(n)]
cd=[[int(x) for x in input().split()] for _ in range(m)]

for a,b in ab:
  ans=list()
  for c,d in cd:
    ans.append(abs(a-c)+abs(b-d))
  print(ans.index(min(ans))+1)

def f(gx,gy):
    ans = 10**9
    no = 0
    for i in range(m):
        tmp = abs(gx-checkpoint[i][0]) + abs(gy-checkpoint[i][1])
        if tmp < ans:
            ans = tmp
            no = i
    return no+1

n,m = list(map(int,input().split()))
gakusei = []
for i in range(n):
    x,y = list(map(int,input().split()))
    gakusei.append([x,y])
checkpoint = []
for j in range(m):
    x,y = list(map(int,input().split()))
    checkpoint.append([x,y])

#print(gakusei,checkpoint)
for i in range(n):
    print((f(gakusei[i][0],gakusei[i][1])))



import numpy as np

n, m = map(int, input().split())

ab = []
for _ in range(n):
    a, b = map(int, input().split())
    ab.append((a, b))

result = np.zeros([m, n], dtype=np.int64)

cd = []
for i in range(m):
    c, d = map(int, input().split())
    for j, (a, b) in enumerate(ab):
        result[i, j] = abs(a - c) + abs(b - d)

print(*result.argmin(axis=0) + 1, sep="\n")

n,m = map(int,input().split())
P = [list(map(int,input().split())) for _ in range(n)]
C = [list(map(int,input().split())) for _ in range(m)]

for i in range(n):
  d = 10**18
  t = 0
  for j in range(m):
    dist = abs(P[i][0]-C[j][0]) + abs(P[i][1]-C[j][1])
    if d > dist:
      t = j
      d = dist
  print(t+1)

N, M = list(map(int, input().split()))
a = []; b = []; c = []; d = []

for i in range(N):
    x, y = list(map(int, input().split()))
    a.append(x)
    b.append(y)
for i in range(M):
    x, y = list(map(int, input().split()))
    c.append(x)
    d.append(y)

for i in range(N):
    m = abs(a[i] - c[0]) + abs(b[i] - d[0])
    p = 0
    for j in range(1, M):
        if m > abs(a[i] - c[j]) + abs(b[i] - d[j]):
            m = abs(a[i] - c[j]) + abs(b[i] - d[j])
            p = j
    print((p + 1))


n, m = map(int, input().split())
a = [0] *n
b = [0] *n
c = [0] *m
d = [0] *m
for i in range(n):
    a[i], b[i] = map(int, input().split())
for j in range(m):
    c[j], d[j] = map(int, input().split())

ans = []



for i in range(n):
    judge = 10 ** 9
    num = 0
    for j in range(m):
        if judge > abs(a[i]-c[j])+abs(b[i]-d[j]):
            judge = abs(a[i]-c[j])+abs(b[i]-d[j])
            num = j+1
    ans.append(num)
#print(ans)
for i in ans:
    print(i)

import itertools
url = "https://atcoder.jp//contests/abc057/tasks/abc057_a"

def main():
    n, m = list(map(int, input().split()))
    ab = [list(map(int, input().split())) for _ in range(n)]
    cd = [list(map(int, input().split())) for _ in range(m)]
    for i in range(len(ab)):
        dist = []
        for k in range(len(cd)):
            tmp = abs(ab[i][0] - cd[k][0]) + abs(ab[i][1] - cd[k][1])
            dist.append(tmp)
        print(dist.index(min(dist)) + 1)


def __starting_point():
    main()
__starting_point()

n,m = map(int,input().split())
st = []
co = []
for i in range(n):
  a,b = map(int,input().split())
  st.append([a,b])
for i in range(m):
  c,d = map(int,input().split())
  co.append([c,d])
for a,b in st:
  tmp = 10**9
  output = 0
  for i in range(m):
    if tmp > (new:=abs(a-co[i][0])+abs(b-co[i][1])):
      output = i+1
      tmp = new
  print(output)  

n, m = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
c = [0] * m
d = [0] * m
for j in range(m):
    c[j], d[j] = map(int, input().split())
for i in range(n):
    e = []
    for j in range(m):
        e.append(abs(a[i] - c[j]) + abs(b[i] - d[j]))
    f = e.index(min(e))
    print(f + 1)

n, m = map(int, input().split())
s_pos = []
c_pos = []

for i in range(n):
    a, b = map(int, input().split())
    s_pos.append([a, b])

for i in range(m):
    c, d = map(int, input().split())
    c_pos.append([c, d])

for i in range(n):
    min_dist = 10 ** 16
    c_index = 0
    for j in range(m):
        dist = abs(s_pos[i][0] - c_pos[j][0]) + abs(s_pos[i][1] - c_pos[j][1])
        if dist < min_dist:
            min_dist = dist
            c_index = j + 1
    print(c_index)

n, m = map(int, input().split())
ab = list(list(map(int, input().split())) for _ in range(n))
cd = list(list(map(int, input().split())) for _ in range(m))

for j in range(n):
    a, b = ab[j][0], ab[j][1]
    ans, res = 0, 1001001001
    for i in range(m):
        c, d = cd[i][0], cd[i][1]
        if abs(a-c)+abs(b-d) < res:
            res = abs(a-c)+abs(b-d)
            ans = i+1
    print(ans)

N, M = list(map(int, input().split()))
X = []
for i in range(N):
    x = list(map(int, input().split()))
    X.append(x)
Y = []
for i in range(M):
    y = list(map(int, input().split()))
    Y.append(y)


for i in X:
    len = []
    for j in Y:
        len.append(abs(i[0]-j[0])+abs(i[1]-j[1]))
    print((len.index(min(len))+1))


#
# abc057 b
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2 2
2 0
0 0
-1 0
1 0"""
        output = """2
1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3 4
10 10
-10 -10
3 3
1 2
2 3
3 5
3 5"""
        output = """3
1
2"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """5 5
-100000000 -100000000
-100000000 100000000
100000000 -100000000
100000000 100000000
0 0
0 0
100000000 100000000
100000000 -100000000
-100000000 100000000
-100000000 -100000000"""
        output = """5
4
3
2
1"""
        self.assertIO(input, output)


def resolve():
    N, M = list(map(int, input().split()))
    S = [list(map(int, input().split())) for _ in range(N)]
    C = [list(map(int, input().split())) for _ in range(M)]

    ans = []
    for s in S:
        D = float("inf")
        t = 0
        for i in range(M):
            d = abs(s[0]-C[i][0]) + abs(s[1]-C[i][1])
            if d < D:
                D = d
                t = i
        ans.append(t+1)

    for a in ans:
        print(a)


def __starting_point():
    # unittest.main()
    resolve()

__starting_point()

n,m=list(map(int,input().split()))

students=[]
for _ in range(n):
    students.append(list(map(int,input().split())))

checks=[]
for _ in range(m):
    checks.append(list(map(int,input().split())))

for student in students:
    index = 1
    min = 10**8*4
    for i,check in enumerate(checks,1):
        tmp=abs(student[0]-check[0])+abs(student[1]-check[1])
        if min>tmp:
            min=tmp
            index=i
    print(index)


n,m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
b = [list(map(int,input().split())) for i in range(m)]
for i in range(n):
    c = float("inf")
    e = 0
    g = 0
    for j in range(m):
        d = abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])
        g+=1
        if d <c:
            c,e=d,g
    print(e)

N,M = [int(c) for c in input().split()]
ab = [list(map(int,input().split())) for c in range(N)]
cd = [list(map(int,input().split())) for c in range(M)]
for i in range(N):
    mi = 2*10**9
    for j in range(M):
        tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if mi > tmp:
            mi = tmp
            ans = j+1
    print(ans)


n,m=list(map(int,input().split()))
l_n=[list(map(int,input().split())) for _ in range(n)]
l_m=[list(map(int,input().split())) for _ in range(m)]
# print(l_n,l_m)


for i,j in l_n:
    distance=0
    cnt = 0
    ans = float ( "inf" )
    for k,l in enumerate(l_m,1):
        a,b=l
        distance=abs(i-a)+abs(j-b)
        if ans>distance:
            ans=min(ans,distance)
            cnt=k
    print(cnt)


n, m = map(int, input().split())
st = []
cp = []
for i in range(n):
    st.append(list(map(int, input().split())))
for i in range(m):
    cp.append(list(map(int, input().split())))

for i in range(n):
    distance = 0
    shortest_cp = 0
    for j in range(m):
        if j == 0:
            distance = 1
            shortest_cp = abs(st[i][0]-cp[j][0]) + abs(st[i][1]-cp[j][1])
        else:
            if (abs(st[i][0]-cp[j][0]) + abs(st[i][1]-cp[j][1])) < shortest_cp:
                distance = j + 1
                shortest_cp = abs(st[i][0]-cp[j][0]) + abs(st[i][1]-cp[j][1])
                
    print(distance)

import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    
    N, M = NMI()
    AB = [NLI() for _ in range(N)]
    CD = [NLI() for _ in range(M)]    

    
    for n in range(N):
        A = AB[n][0]
        B = AB[n][1]
        
        distance = []
        for m in range(M):
            C = CD[m][0]
            D = CD[m][1]
            distance.append(abs(A-C)+abs(B-D))
            
        print(distance.index(min(distance))+1)


def __starting_point():
    main()
__starting_point()

N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]
for i in range(N):
    ans = -1
    dist = 10**12
    for j in range(M):
        tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]) 
        if tmp < dist:
            ans = j
            dist = tmp
    print(ans+1)

n, m = list(map(int, input().split()))
lx = []
ly = []

for i in range(n + m):
    x, y = list(map(int, input().split()))
    lx.append(x)
    ly.append(y)

for i in range(n):
    r = []
    for j in range(n, m + n):
        r.append(abs(lx[i] - lx[j]) + abs(ly[i] - ly[j]))
    print((r.index(min(r)) + 1))


n, m = list(map(int, input().split()))
al = [list(map(int, input().split())) for _ in range(n)]
cl = [list(map(int, input().split())) for _ in range(m)]

for a in al:
    ans, dis = 0, 1001001001
    for i in range(m):
        _dis = abs(a[0]-cl[i][0]) + abs(a[1]-cl[i][1])
        if _dis < dis:
            ans, dis = i+1, _dis
    print(ans)


n, m = [int(x) for x in input().split()]
a = []
for i in range(n):
  a.append([int(x) for x in input().split()])
c = []
for i in range(m):
  c.append([int(x) for x in input().split()])

for i in range(n):
  d = 10 ** 9
  cc = 0
  for j in range(m):
    di = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1])
    if di < d:
      d = di
      cc = j
  print(cc + 1)

n,m=map(int, input().split())
ab=[list(map(int,input().split())) for i in  range(n)]
cd=[list(map(int,input().split())) for i in  range(m)]
for i in range(n):
  Min=4*(10**8)+1
  for j in range(m):
    d = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1]-cd[j][1])
    #print(d,ab[i][0],cd[j][0])
    if Min > d:
      Min = d
      ans = j+1
  print(ans)

n,m=list(map(int,input().split()))
student=[]
for _ in range(n):
    a,b=list(map(int,input().split()))
    student.append([a,b])

checkpoint =[]
for _ in range(m):
    c,d = list(map(int,input().split()))
    checkpoint.append([c,d])

for i in range(n):
    s = student[i]
    dist = float('inf')

    num=0
    for j in range(m):
        c=checkpoint[j]
        tmp = abs(s[0]-c[0]) + abs(s[1]-c[1])

        if tmp < dist:
            dist = tmp
            num=j+1

    print(num)
        


n,m=list(map(int,input().split()))
l_n=[list(map(int,input().split())) for _ in range(n)]
l_m=[list(map(int,input().split())) for _ in range(m)]
# print(l_n,l_m)


for i,j in l_n:
    distance=0
    cnt = 0
    ans = float ( "inf" )
    for k,l in enumerate(l_m):
        a,b=l
        distance=abs(i-a)+abs(j-b)
        if ans>distance:
            ans=min(ans,distance)
            cnt=k+1
    print(cnt)


n, m = list(map(int, input().split()))
X = [tuple(map(int, input().split())) for _ in range(n)]
Y = [tuple(map(int, input().split())) for _ in range(m)]


for x in X:
    d1 = sum(x)
    d2 = x[0] - x[1]
    z = 10 ** 9
    for i, y in enumerate(Y, 1):
        D1 = sum(y)
        D2 = y[0] - y[1]
        Z = max(abs(D1 - d1), abs(D2 - d2))
        if z > Z:
            z = Z
            ans = i
    print(ans)


N, M = map(int, input().split())
student = [list(map(int, input().split())) for i in range(N)]
check = [list(map(int, input().split())) for i in range(M)]

tmp = []
for i in range(len(student)):
    for j in range(len(check)):
        x = abs(student[i][0] - check[j][0])
        y = abs(student[i][1] - check[j][1])
        tmp.append(x+y)
    print(tmp.index(min(tmp))+1)
    tmp = []

N, M = map(int, input().split())

# 学生N人の現在地(a,b)
A_B = [list(map(int, input().split())) for _ in range(N)]
# チェックポイントM個の場所(c,d)
C_D = [list(map(int, input().split())) for _ in range(M)]


for a, b in A_B:
    temp_distance = 10**10
    temp_checkpoint = -1
    checkpoint_count = 1
    for c, d in C_D:
        manhattan_distance = abs(a-c) + abs(b-d)
        if temp_distance > manhattan_distance:
            temp_distance = manhattan_distance
            temp_checkpoint = checkpoint_count
        checkpoint_count += 1
    print(temp_checkpoint)

N, M = map(int, input().split())
a = []
c = []
for i in range(N):
  x, y = map(int, input().split())
  a.append([x, y])
for i in range(M):
  x, y = map(int, input().split())
  c.append([x, y])

for i in a:
  tmp = 10**9
  for l in range(M):
    j = c[l]
    x = abs(i[0]-j[0]) + abs(i[1]-j[1])
    if tmp > x:
      tmp = x
      ans = l + 1
  print(ans)

n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]

for a,b in ab:
    ans = []
    for c,d in cd:
        ans.append(abs(a-c)+abs(b-d))
    print(ans.index(min(ans))+1)

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for p in range(n)]
cd = [list(map(int, input().split())) for q in range(m)]
for i in range(n):
    x = 10**10
    ans = 0
    for j in range(m):
        if abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]) < x:
            ans = j+1
            x = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
    print(ans)

n,m=map(int,input().split())
s=[list(map(int,input().split())) for _ in range(n)]
c=[list(map(int,input().split())) for _ in range(m)]
where=[]
for i in range(n):
    distance=10**9
    for j in range(m):
        if distance>abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1]):
            distance=abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1])
            w=j
    where.append(w+1)
[print(i) for i in where]

n,m = map(int,input().split())
stu = []
che = []
kyori = []
ans = []
for _ in range(n):
  stu.append(list(map(int,input().split())))
for _ in range(m):
  che.append(list(map(int,input().split())))
for x in range(n):
  for y in range(m):
    kyori.append(abs(stu[x][0]-che[y][0])+abs(stu[x][1]-che[y][1]))
  z = min(kyori)
  ans.append(kyori.index(z)+1)
  kyori = []
for i in range(len(ans)):
  print(ans[i])

n, m = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(n)]
c = [list(map(int, input().split())) for _ in range(m)]
ans = []
INF = 10**9+7
for x in s:
  d = INF
  ind = INF
  for i,y in enumerate(c):
    exd = d
    d = min(d,abs(x[0]-y[0])+abs(x[1]-y[1]))
    if d != exd:
      ind = i
  ans.append(ind+1)
for x in ans:
  print(x)

N, M = list(map(int, input().split()))

P = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    P.append([a, b])

C = []
for _ in range(M):
    c, d = list(map(int, input().split()))
    C.append([c, d])

for i in range(N):
    ans = float('inf')
    num = float('inf')
    for j in range(M):
        if num > abs(P[i][0] - C[j][0]) + abs(P[i][1] - C[j][1]):
            num = abs(P[i][0] - C[j][0]) + abs(P[i][1] - C[j][1])
            ans = j + 1

    print(ans)


n,m=list(map(int,input().split()))

a_lis=[list(map(int,input().split())) for i in range(n)]
c_lis=[list(map(int,input().split())) for i in range(m)]

for i in range(n):
  num=0
  ans=10**10
  for j in reversed(list(range(m))):
    a=a_lis[i]
    c=c_lis[j]
    num=abs(a[0]-c[0])+abs(a[1]-c[1])
    ans=min(ans,num)
    if num==ans:
      cnt=j+1
  print(cnt)
    


n,m=list(map(int,input().split()))
a=[list(map(int,input().split())) for _ in range(n)]
b=[list(map(int,input().split())) for _ in range(m)]
for i in range(n):
    ans=-1
    num=10**10
    for j in range(m):
        cnt=abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])
        if cnt<num:
            ans=j+1
            num=cnt
    print(ans)


n, m = map(int, input().split())
students = [list(map(int, input().split())) for i in range(n)]

targets = [list(map(int, input().split())) for i in range(m)]
x = 0
snumber = [(0, x)] * n
  
def md(s, t):
  d = abs(s[0] - t[0]) + abs(s[1] - t[1])
  return d

for i in range(n):
  x = 4 * 10 ** 8
  for j in range(m):    
    if x > md(students[i], targets[j]):
      x = md(students[i], targets[j])
      snumber[i] = (j+1, md(students[i], targets[j]))
      
for i in range(n):      
  print(snumber[i][0])

n, m = list(map(int, input().split()))
al = list(list(map(int, input().split())) for _ in range(n))
cl = list(list(map(int, input().split())) for _ in range(m))

for a in al:
    ans = 1001001001
    no = 0
    for i in range(m):
        dis = abs(a[0]-cl[i][0])+abs(a[1]-cl[i][1])
        if dis < ans:
            ans = dis
            no = i
    print((no+1))


# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


n, m = zz()
A, B = [], []
for i in range(n):
    a, b = zz()
    A.append(a)
    B.append(b)
C, D = [], []
for i in range(m):
    c, d = zz()
    C.append(c)
    D.append(d)

dist = [[0]*m for i in range(n)]
for i in range(n):
    for j in range(m):
        dist[i][j] = abs(A[i] - C[j]) + abs(B[i] - D[j])


for i in range(n):
    print((np.argmin(dist[i])+1))


N, M = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(N)]
cd = [tuple(map(int, input().split())) for _ in range(M)]

for a, b in ab:
    check_point_dist = 10 ** 8 * 4 + 1
    check_point = 0
    count = 0
    for c, d in cd:
        count += 1
        if check_point_dist > abs(a - c) + abs(b - d):
            check_point = count
            check_point_dist = abs(a - c) + abs(b - d)
    else:
        print(check_point)

N, M = list(map(int,input().split()))
stu = []
che = []
for i in range(N):
    ab = list(map(int,input().split()))
    stu.append(ab)
for i in range(M):
    cd = list(map(int,input().split()))
    che.append(cd)
ans = 0
dis = 0
x = 5 * 10 ** 8

for i in range(N):
    for j in range(M):
        dis = abs(stu[i][0] - che[j][0]) + abs(stu[i][1] - che[j][1])
        
        if dis < x:
            x = dis
            ans = j + 1
        

    print(ans)
    x = 5 * 10 ** 8


import sys

input = sys.stdin.readline

N, M = map(int, input().split())
s = []
for _ in range(N):
    a, b = map(int, input().split())
    s.append((a, b))

g = []
for _ in range(M):
    c, d = map(int, input().split())
    g.append((c, d))

ans = []
for i in range(N):
    a, b = s[i]
    i_ans = -1
    tmp = float("inf")
    for j in range(M):
        c, d = g[j]
        dist = abs(c-a) + abs(d-b)
        # print(i, j, dist)
        if dist < tmp:
            i_ans = j
            tmp = dist
    ans.append(i_ans)

for a in ans:
    print(a+1)

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]

ans = []
for i in range(n):
    dis = []
    for j in range(m):
        dis.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]))
    ans.append(dis.index(min(dis)) + 1)
for i in ans:
    print(i)

n, m = map(int, input().split())

s = [tuple(map(int, input().split())) for _ in range(n)]
c = [tuple(map(int, input().split())) for _ in range(m)]

for a, b in s:
    d = float('inf')
    for i in range(m):
        x, y = c[i]
        if abs(a - x) + abs(b - y) < d:
            d = abs(a - x) + abs(b - y)
            ans = i + 1
    print(ans)

N, M = map(int,input().split())
students = []
points = []
for _ in range(N):
    students.append(list(map(int,input().split())))
for _ in range(M):
    points.append(list(map(int,input().split())))

for i in range(N):
    MIN = 10 ** 10
    index = -1
    for j in range(M):
        if MIN > abs(students[i][0] - points[j][0]) + abs(students[i][1] - points[j][1]):
            MIN = abs(students[i][0] - points[j][0]) + abs(students[i][1] - points[j][1])
            index = j
    print(index + 1)

n, m = list(map(int, input().split()))
stu = []
checkpoints = []
for _ in range(n):
    ab = list(map(int, input().split()))
    stu.append(list(ab))
for _ in range(m):
    cd = list(map(int, input().split()))
    checkpoints.append(list(cd))

for s in stu:
    checkpoint_id = 1010101
    manhatttaaann_dis = 2 * (10**18) + 101010101
    for i, cp in enumerate(checkpoints):
        dist = abs(s[0] - cp[0]) + abs(s[1] - cp[1])
        if dist < manhatttaaann_dis:
            manhatttaaann_dis = dist
            checkpoint_id = i
    print((checkpoint_id + 1))


n, m = map(int, input().split())
al = []
bl = []
for i in range(n):
    a, b = map(int, input().split())
    al.append([a, b])
for j in range(m):
    c, d = map(int, input().split())
    bl.append([c,d])

def check(a,b):
    x = a[0] - b[0]
    y = a[1] - b[1]
    if x < 0:
        x = -x
    if y < 0:
        y = -y
    return x + y

for a in al:
    min = 1000000000
    cnt = 1
    for b in bl:
        tmp = check(a,b)
        if tmp < min:
            ans = cnt
            min = tmp
        cnt += 1
    print(ans)

N,M=list(map(int,input().split()))
ab=[[int(x) for x in input().split()] for _ in range(N)]
cd=[[int(x) for x in input().split()] for _ in range(M)]

for a,b in ab:
  ans=list()
  for c,d in cd:
    ans.append(abs(a-c)+abs(b-d))
  print((ans.index(min(ans))+1))


n, m = map(int, input().split())

student = [None]*n
for i in range(n):
  student[i] = tuple(map(int, input().split()))

point = [None]*m
for i in range(m):
  point[i] = tuple(map(int, input().split()))

for i in range(n):
  dist = pow(10, 9)
  ans = 0
  x, y = student[i]
  for j in range(m):
    sub = abs(point[j][0]-x) + abs(point[j][1]-y)
    if dist > sub:
      dist = sub
      ans = j+1
  print(ans)

n, m  = list(map(int, input().split()))
pos = []
check = []
for i in range(n):
  a, b  = list(map(int, input().split()))
  pos.append([a, b])

for i in range(m):
  c, d  = list(map(int, input().split()))
  check.append([c, d])

for i in range(n):
  ans = 0
  k = 10**9
  for j in range(m):
    t = abs(pos[i][0] - check[j][0]) + abs(pos[i][1] - check[j][1])
    if k > t:
      k = t
      ans = j + 1
  print(ans)


n, m = map(int, input().split())
a = [0] * n
b = [0] * n
c = [0] * m
d = [0] * m
for i in range(n):
    a[i], b[i] = map(int, input().split())
for i in range(m):
    c[i], d[i] = map(int, input().split())

for i in range(n):
    dist = abs(a[i]-c[0])+abs(b[i]-d[0])
    point = 1
    for j in range(1, m):
        if dist > (abs(a[i]-c[j])+abs(b[i]-d[j])):
            dist = (abs(a[i]-c[j])+abs(b[i]-d[j]))
            point = j+1
    print(point)

n, m = list(map(int, input().split()))
a, b, c, d = [], [], [], []
for _ in range(n):
  an, bn = list(map(int, input().split()))
  a.append(an)
  b.append(bn)
for _ in range(m):
  cn, dn = list(map(int, input().split()))
  c.append(cn)
  d.append(dn)
  
def dist(x1, y1, x2, y2):
  return abs(x1-x2)+abs(y1-y2)

for i in range(n):
  minimum = 10**9
  min_id = 0
  for j in range(m):
    ds = dist(a[i], b[i], c[j], d[j])
    if ds < minimum:
      minimum = ds
      min_id = j
  print((min_id+1))


from sys import stdin, stdout # only need for big input

def manhattan_distance(p1, p2):
    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])

def solve():
    n, m = list(map(int, input().split()))
    students = []
    check_points = []

    for _ in range(n):
        a, b = list(map(int, input().split()))
        students.append((a,b))
    
    for _ in range(m):
        c, d = list(map(int, input().split()))
        check_points.append((c,d))
    
    for s in students:
        cur_closest_dist = int(4e8)
        cur_closest_point = -1 
        for i in range(m):
            c = check_points[i]
            if manhattan_distance(s, c) < cur_closest_dist:
                cur_closest_dist = manhattan_distance(s,c)
                cur_closest_point = i 
        print(cur_closest_point + 1)


def main():
    solve()


def __starting_point():
    main()
__starting_point()

n,m = map(int,input().split())
P = [list(map(int,input().split())) for _ in range(n)]
C = [list(map(int,input().split())) for _ in range(m)]

for i in range(n):
  min_dist = 10**18
  idx = 0
  for j in range(m):
    dist = abs(P[i][0]-C[j][0]) + abs(P[i][1]-C[j][1])
    if min_dist > dist:
      idx = j + 1
      min_dist = dist
  print(idx)

n,m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]

def distance(x,y,i,j):
    return abs(x-i) + abs(y-j)

for a,b in ab:
    # 各チェックポイントとの距離
    dists = [distance(a, b, c, d) for c,d in cd]
    print(dists.index(min(dists)) + 1)

n, m = map(int, input().split())
sd = []
cp = []

for i in range(n):
  sd.append([int(j) for j in input().split()])
for i in range(m):
  cp.append([int(j) for j in input().split()])  
  
dist = [[0 for i in range(m)] for j in range(n)]

for i in range(n):
  for j in range(m):
    dist[i][j] = abs(sd[i][0] - cp[j][0]) + abs(sd[i][1] - cp[j][1])
    
for i in range(n):
  print(dist[i].index(min(dist[i]))+1)

def distance(coordinate1, coordinate2):
    x1 = coordinate1[0]
    y1 = coordinate1[1]
    x2 = coordinate2[0]
    y2 = coordinate2[1]
    return abs(x1 - x2) + abs(y1 - y2)


def main():
    n, m = map(int, input().split())
    ab_lst = [list(map(int, input().split())) for _ in range(n)]
    cd_lst = [list(map(int, input().split())) for _ in range(m)]
    point_lst = []

    for i in range(n):

        distance_lst = []
        for j in range(m):

            coordinate1 = ab_lst[i]
            coordinate2 = cd_lst[j]
            distance_lst.append(distance(coordinate1, coordinate2))

        minimum = min(distance_lst)
        for k in range(m):
            if distance_lst[k] == minimum:
                point_lst.append(k + 1)
                break

    for i in range(n):
        print(point_lst[i])


def __starting_point():
    main()
__starting_point()

import sys
input = sys.stdin.readline

n, m = map(int, input().split())
ab = []
cd = []
for _ in range(n):
    a, b = map(int, input().split())
    ab.append((a, b))
for _ in range(m):
    c, d = map(int, input().split())
    cd.append((c, d))
ans = []
for a, b in ab:
    t = 10**18
    checkpoint = -1
    for i, cdi in enumerate(cd):
        c, d = cdi
        dist = abs(a-c)+abs(b-d)
        if dist < t:
            t = dist
            checkpoint = (i+1)
    ans.append(checkpoint)
print(*ans, sep='\n')


#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
n,m = readInts()
N = [readInts() for _ in range(n)]
M = [readInts() for _ in range(m)]
for a,b in N:
    pos = INF
    ans = None
    for i,(x,y) in enumerate(M):
        if abs(a-x) + abs(b-y) < pos:
            pos = abs(a-x)+abs(b-y)
            ans = i+1
    print(ans)


n, m = map(int,input().split())

ab = []
for i in range(n):
    ab.append(list(map(int, input().split())))
    
cd = []
for i in range(m):
    cd.append(list(map(int, input().split())))

ans = [0] * m
for i in range(n):
    a, b = ab[i][0], ab[i][1]
    dist = [0] * m
    for j in range(m):
        dist[j] = abs(a - cd[j][0]) + abs(b - cd[j][1])
    dm = min(dist)
    for j in range(m):
        if dist[j] == dm:
            print(j+1)
            break

from typing import List


def manhattan_distance(student: List[int], check_point: List[int]) -> int:
    return abs(check_point[0] - student[0]) + abs(check_point[1] - student[1])


def answer(n: int, m: int, students: List[List[int]], check_points: List[List[int]]) -> str:
    students_destination = []
    for student in students:
        mds = {}
        for i, check_point in enumerate(check_points, start=1):
            md = manhattan_distance(student, check_point)
            if md not in list(mds.keys()):
                mds[md] = str(i)
        students_destination.append(mds[min(mds.keys())])

    return '\n'.join(students_destination)


def main():
    n, m = list(map(int, input().split()))
    ab = [list(map(int, input().split())) for _ in range(n)]
    cd = [list(map(int, input().split())) for _ in range(m)]
    print((answer(n, m, ab, cd)))


def __starting_point():
    main()

__starting_point()

def LI():
    return list(map(int, input().split()))


def LIHW(h):
    return [list(map(int, input().split())) for _ in range(h)]


N, M = LI()
Nlist = LIHW(N)
Mlist = LIHW(M)
anslist = [0]*N
for i in range(N):
    a, b = Nlist[i]
    ans = 10**9
    for j in range(M):
        c, d = Mlist[j]
        kyori = abs(c-a)+abs(d-b)
        if ans > kyori:
            ansind = j+1
            ans = kyori
    anslist[i] = ansind

for i in range(N):
    print((anslist[i]))


import math
import collections
from itertools import product

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,m  = mi()
ab = [li() for _ in range(n)]
cd = [li() for _ in range(m)]

for i in range(n):
    length = 10**10
    ans = 0
    for j in range(m):
        if abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]) < length:
            length = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
            ans = j
    print(ans+1)

N,M = map(int,input().split())
stu = []
for v in range(N):
    ai,bi = map(int,input().split())
    stu.append((v,ai,bi))
cp = []
for w in range(M):
    ci,di = map(int,input().split())
    cp.append((w,ci,di))
#大きい番号から調べることで同じ値のとき最小のチェックポイントに行ける
cp = cp[::-1]
ans = [0]*N
#ある学生について    
for i,x,y in stu:
    #あるチェックポイントについて
    mindist = 10**16
    cp_num = 0
    for j,k,l in cp:
        dist = abs(x-k) + abs(y-l)
        if mindist >= dist:
            mindist = dist
            cp_num = j+1
    ans[i] = cp_num
for n in ans:
    print(n)

n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]

for i in range(n):
    shortest = 4*10**8 + 5
    for j in range(m):
        distance = abs(a[i][0] - b[j][0]) + abs(a[i][1] - b[j][1])
        if distance < shortest:
            idx = j
            shortest = distance
    print(idx + 1)

N,M=list(map(int,input().split()))
ab=list(list(map(int,input().split())) for _ in range(N))
cd=list(list(map(int,input().split())) for _ in range(M))

for i in range(N):
    k=0
    d=abs(ab[i][0]-cd[0][0])+abs(ab[i][1]-cd[0][1])
    for j in range(1,M):
        if abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])<d:
            k=j
            d=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
    print((k+1))


lst = input().split()

N = int(lst[0])
M = int(lst[1])

students = []
checkpoints = []

for i in range(N):
   students.append(input().split())

for i in range(M):
   checkpoints.append(input().split())

def distance(P, Q):
   return abs(int(P[0]) - int(Q[0])) + abs(int(P[1]) - int(Q[1]))

for s in students:
   l1 = [10 ** 10]
   l2 = [0]
   for i in range(M):
      if distance(s, checkpoints[i]) < l1[-1]:
         l1.append(distance(s, checkpoints[i]))
         l2.append(i+1)
   print(l2[-1])

N, M = map(int, input().split())
Nlist, Mlist = [], []
res = []

for i in range(N):
    ab = list(map(int, input().split()))
    Nlist.append(ab)

for i in range(M):
    cd = list(map(int, input().split()))
    Mlist.append(cd)

for i in range(N):
    res = 0
    mini = float('inf')
    for j in range(M):
        calc = abs(Nlist[i][0] - Mlist[j][0]) + abs(Nlist[i][1] - Mlist[j][1])
        if calc < mini:
            mini = calc
            res = j+1
    print(res) 

N,M = [int(c) for c in input().split()]
ab = [list(map(int,input().split())) for c in range(N)]
cd = [list(map(int,input().split())) for c in range(M)]
for i in range(N):
    mi = 10**9
    for j in range(M):
        tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if mi > tmp:
            mi = tmp
            ans = j+1
    print(ans)


n, m = map(int, input().split())
students = [list(map(int, input().split())) for _ in range(n)]
points = [list(map(int, input().split())) for _ in range(m)]
ans = []
for i in range(n):
    min_diff = 20 ** 8 + 1
    near_point = 0
    for j in range(m):
        diff = abs(students[i][0] - points[j][0]) + abs(students[i][1] - points[j][1])
        if diff < min_diff:
            min_diff = diff
            near_point = j + 1
    ans.append(near_point)
print("\n".join(map(str, ans)))

N,M = map(int,input().split())
X = []
for i in range(N):
  a,b = map(int,input().split())
  X.append((a,b))
C = []
for i in range(M):
  c,d = map(int,input().split())
  C.append((c,d))
ans = [0 for _ in range(N)]
INF = float("inf")
for i in range(N):
  MIN = INF
  check = -1
  for y in range(M):
    temp = abs(X[i][0]-C[y][0]) + abs(X[i][1]-C[y][1])
    if temp < MIN:
      MIN = temp
      check = y+1
  ans[i] = check
print(*ans,sep="\n")

n,m=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
cd=[list(map(int,input().split())) for _ in range(m)]
r=[]
for i in ab:
  x1,y1=i[0],i[1]
  temp=[]
  for j in cd:
    x2,y2=j[0],j[1]
    temp.append(abs(x1-x2)+abs(y1-y2))
  r.append(temp.index(min(temp))+1)
print(*r,sep='\n')

N,M=map(int,input().split())
a=[0]*N;b=[0]*N;
c=[0]*M;d=[0]*M;
for i in range(N) :
  a[i],b[i]=map(int,input().split())
for i in range(M) :
  c[i],d[i]=map(int,input().split())

for i in range(N) :
  min=0
  for j in range(M) :
    if abs(a[i]-c[min])+abs(b[i]-d[min]) > abs(a[i]-c[j])+abs(b[i]-d[j]) :
      min=j
  print(min+1)

# B - Checkpoints
def main():
    n, m = map(int, input().split())
    a_b = [input().split() for i in range(n)]
    c_d = [input().split() for i in range(m)]

    for i in range(n):
        temp = []
        for j in range(m):
            temp.append(abs(int(a_b[i][0])-int(c_d[j][0]))+abs(int(a_b[i][1])-int(c_d[j][1])))
        else:
            print(temp.index(min(temp))+1)


        
def __starting_point():
    main()
__starting_point()

n,m = map(int, input().split(" "))
a = [list(map(int, input().split(" "))) for i in range(n)]
b = [list(map(int, input().split(" "))) for i in range(m)]

for ax, ay in a:
  c = []
  for bx, by in b:
    c.append(abs(bx-ax)+abs(by-ay))
  print(c.index(min(c)) + 1)

n,m=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(n)]
cd=[list(map(int,input().split())) for j in range(m)]
for i in range(n):
  dis=float('inf')
  ch=0
  for j in range(m):
    if dis>abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]):
      dis=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
      ch=j
  print((ch+1))


n,m = map(int, input().split())
st = []
pt = []
ch = []
for i in range(n):
  st.append(list(map(int, input().split())))
for i in range(m):
  pt.append(list(map(int, input().split())))
for j in st:
  for k in pt:
    d = abs(j[0]-k[0]) + abs(j[1]-k[1])
    ch.append(d)
  print(ch.index(min(ch))+1)
  ch = []

N, M = map(int, input().split())
Std = [tuple(map(int, input().split())) for _ in range(N)]
Chp = [tuple(map(int, input().split())) for _ in range(M)]
INF = 10e9
Arrv = []
Mdist = lambda x,y,u,v:abs(x-u)+abs(y-v)
for s in Std:
    close = INF
    for i in range(M):
        dist = Mdist(*s,*Chp[i])
        if dist < close:
            close = dist
            arrv = i+1
    Arrv.append(arrv)
for ar in Arrv:
    print(ar)    

n, m = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(n)]
cd = [tuple(map(int, input().split())) for _ in range(m)]

for i in range(n):
    x = 1 << 30
    y = -1
    a, b = ab[i]
    for j in range(m):
        c, d = cd[j]
        d = abs(a - c) + abs(b - d)
        if x > d:
            x = d
            y = j
    print((y + 1))


n,m=map(int,input().split())
A=[]
B=[]
C=[]
D=[]
E=[]
ans=0
for i in range(n):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
for i in range(m):
    c,d=map(int,input().split())
    C.append(c)
    D.append(d)
for i in range(n):
    for j in range(m):
        ans = abs(A[i]-C[j])+abs(B[i]-D[j])
        E.append(ans)
        ans=0
    print(E.index(min(E))+1)
    E.clear()

n,m=map(int,input().split())
ab,cd=[list(map(int,input().split())) for _ in range(n)],[list(map(int,input().split())) for _ in range(m)]
for i in ab:
  r=[]
  for j in cd: r.append(abs(i[0]-j[0])+abs(i[1]-j[1]))
  print(r.index(min(r))+1)

N,M = map(int,input().split())
stu = [0]*N
for i in range(N):
    stu[i] = list(map(int,input().split()))

cp = [0]*M
for i in range(M):
    cp[i] = list(map(int,input().split()))

# print(stu,cp)
stumo = [0]*N
for i in range(N):
    min_move = 10000000000000000000000000
    for j in range(M):
        min_his = min_move 
        mhd = abs(stu[i][0]-cp[j][0]) + abs(stu[i][1]-cp[j][1])
        min_move = min(min_move,mhd)
        if(min_move != min_his):
            stumo[i] = j+1
# print(stumo)
for i in range(N):
    print(stumo[i])

N,M = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(N)]
cd = [list(map(int,input().split())) for _ in range(M)]

for i in range(N):
  dist = float("inf")
  ans = 0
  a,b = ab[i][0],ab[i][1]
  
  for j in range(M)[::-1]:
    c,d = cd[j][0],cd[j][1]
    if abs(a-c) + abs(b-d) <= dist:
      dist = abs(a-c) + abs(b-d)
      ans = j + 1
  
  print(ans)

import sys

n,m = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(n)]
b = [list(map(int,input().split())) for i in range(m)]
chkPoint = [0]*n

for i,axy in enumerate(a):
    ax,ay = axy
    dist = sys.maxsize
    for j,bxy in enumerate(b):
        bx,by = bxy
        if dist > abs(ax-bx)+abs(ay-by):
            chkPoint[i] = j+1
            dist = abs(ax-bx)+abs(ay-by)
    print((chkPoint[i]))


from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n,m=nii()
ab=[lnii() for i in range(n)]
cd=[lnii() for i in range(m)]

ans=[]
for a,b in ab:
  min_dist=10**10
  for i in range(m):
    c,d=cd[i]
    if abs(a-c)+abs(b-d)<min_dist:
      t_ans=i
      min_dist=abs(a-c)+abs(b-d)
  ans.append(t_ans+1)

for i in ans:
  print(i)

N,M=list(map(int,input().split()))
A=[]
B=[]
C=[]
D=[]
for i in range(N):
	x,y=list(map(int,input().split()))
	A.append(x)
	B.append(y)
for i in range(M):
	x,y=list(map(int,input().split()))
	C.append(x)
	D.append(y)
for i in range(N):
	ans=[]
	for j in range(M):
		tmp=abs(A[i]-C[j])+abs(B[i]-D[j])
		ans.append(tmp)
	T=len(ans)
	for k in range(T):
		if ans[k]==min(ans):
			print((k+1))
			break


N, M = map(int, input().split())
S = [tuple(map(int, input().split())) for _ in range(N)]
C = [tuple(map(int, input().split())) for _ in range(M)]
for i in S:
  ans = 0
  k = 10 ** 10
  for j in range(M):
    n = abs(i[0] - C[j][0]) + abs(i[1] - C[j][1])
    if k > n:
      k = n
      ans = j + 1
  else:
    print(ans)

n, m = list(map(int,input().split()))
s_x_plus_y = []
s_x_minus_y = []
p_x_plus_y = []
p_x_minus_y = []

for student in range(n):
    x, y = list(map(int,input().split()))
    s_x_plus_y.append(x + y)
    s_x_minus_y.append(x - y)

for i in range(m):
    x, y = list(map(int,input().split()))
    p_x_plus_y.append(x + y)
    p_x_minus_y.append(x - y)


for i in range(n):
    p_dist = []
    for j in range(m):
        p1 = abs(s_x_plus_y[i] - p_x_plus_y[j])
        p2 = abs(s_x_minus_y[i] - p_x_minus_y[j])
        d = max(p1, p2)
        p_dist.append(d)
    print((p_dist.index(min(p_dist))+1))


n,m=map(int,input().split())
ab=[list(map(int, input().split())) for i in range(n)]
cd=[list(map(int, input().split())) for j in range(m)]

for i in range(n):
    l=[]
    for j in range(m):
        dist=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        l.append(dist)
    goal = l.index(min(l))+1
    print(goal)

def dis(a, b, c, d):
    num = abs(a - c) + abs(b - d)
    return num

n,m = list(map(int,input().split()))
a = [0] * n
b = [0] * n
c = [0] * m
d = [0] * m

for i in range(n):
    a[i], b[i] = list(map(int,input().split()))
for i in range(m):
    c[i], d[i] = list(map(int, input().split()))

for i in range(n):
    ans = []
    for j in range(m):
        ans.append(dis(a[i],b[i],c[j],d[j]))
    print((ans.index(min(ans)) + 1))



def dist(x, y):
    return abs(x[0] - y[0]) + abs(x[1] - y[1])


N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
CD = [list(map(int, input().split())) for _ in range(M)]
for i in range(N):
    ans = -1
    min_dist = float("inf")
    for j in range(M):
        if (d := dist(AB[i], CD[j])) < min_dist:
            ans = j
            min_dist = d
    print((ans + 1))


import sys, math
from itertools import combinations as c, product as p
from collections import deque
sys.setrecursionlimit(10**9)
INF = float('inf')
MOD = 10**9 + 7
#MOD = 998244353


def si(): return input()
def ii(): return int(input())
def fi(): return float(input())
def lstr(): return input().split()
def lint(): return list(map(int, input().split()))
def lintdec(): return list(map(lambda x:int(x) - 1, input().split()))
def lnstr(n): return [input() for _ in range(n)]
def lnint(n): return [int(input()) for _ in range(n)]
def lint_list(n): return [lint() for _ in range(n)]



############################################################
N, M = lint()
students = lint_list(N)
check = lint_list(M)

for sx, sy in students:
    ans = -1
    dist = INF
    for i in range(M):
        cx, cy = check[i]
        tmp = abs(cx - sx) + abs(cy - sy)
        if tmp < dist:
            dist = tmp
            ans = i + 1
    print(ans)

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
for i in range(n):
    num = 0
    ans = float('inf')
    for j in range(m):
        man = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if man < ans :
            ans = man
            num = j
    print(num+1)

n,m =map(int,input().split())
a=[0]*n
b=[0]*n
c=[0]*m
d=[0]*m
for i in range(n):
    a[i],b[i]=map(int,input().split())
for i in range(m):
    c[i],d[i]=map(int,input().split())

for i in range(n):
    for j in range(m):
        if j==0:
            ind=0
            dis=abs(a[i]-c[j])+abs(b[i]-d[j])
        else:
            if abs(a[i]-c[j])+abs(b[i]-d[j])<dis:
                ind=j
                dis = abs(a[i] - c[j]) + abs(b[i] - d[j])
    print(ind+1)

n, m = list(map(int, input().split()))
ab = []
for i in range(n):
    ab.append(list(map(int, input().split())))

cd = []
for i in range(m):
    cd.append(list(map(int, input().split())))

for i in range(n):
    a, b = ab[i]
    dis = 10 ** 9
    point = 0
    for j in range(m):
        c, d = cd[j]
        if abs(a - c) + abs(b - d) < dis:
            point = j + 1
            dis = abs(a - c) + abs(b - d)
    print(point)