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.
[{"code": "n,m=list(map(int,input().split()))\nab=[[int(x) for x in input().split()] for _ in range(n)]\ncd=[[int(x) for x in input().split()] for _ in range(m)]\n\nfor a,b in ab:\n  ans=list()\n  for c,d in cd:\n    ans.append(abs(a-c)+abs(b-d))\n  print((ans.index(min(ans))+1))\n", "passed": true, "time": 0.18, "memory": 14384.0, "status": "done"}, {"code": "n,m = map(int, input().split())\nnum_list = []\nfor i in range(n):\n  num_list.append(list(map(int,input().split())))\ncheck_list = []\nfor i in range(m):\n  check_list.append(list(map(int,input().split())))\n\nfor i in range(n):\n  d = 10**9\n  h = 0\n  for j in range(m):\n    if d > (abs(num_list[i][0]-check_list[j][0])+abs(num_list[i][1]-check_list[j][1])):\n      d = abs(num_list[i][0]-check_list[j][0])+abs(num_list[i][1]-check_list[j][1])\n      h = j+1\n  print(h)", "passed": true, "time": 0.18, "memory": 14188.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nab = []\nfor _ in range(N):\n    ab.append(list(map(int, input().split())))\ncd = []\nfor _ in range(M):\n    cd.append(list(map(int, input().split())))\n    \nfor x in ab:\n    a = x[0]\n    b = x[1]\n    cnt = []\n    for y in cd:\n        c = y[0]\n        d = y[1]\n        k = abs(a-c)+abs(b-d)\n        cnt.append(k)\n    print(cnt.index(min(cnt))+1)", "passed": true, "time": 0.15, "memory": 14204.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nab=[[int(x) for x in input().split()] for _ in range(n)]\ncd=[[int(x) for x in input().split()] for _ in range(m)]\n\nfor a,b in ab:\n  ans=list()\n  for c,d in cd:\n    ans.append(abs(a-c)+abs(b-d))\n  print(ans.index(min(ans))+1)", "passed": true, "time": 0.27, "memory": 14316.0, "status": "done"}, {"code": "def f(gx,gy):\n    ans = 10**9\n    no = 0\n    for i in range(m):\n        tmp = abs(gx-checkpoint[i][0]) + abs(gy-checkpoint[i][1])\n        if tmp < ans:\n            ans = tmp\n            no = i\n    return no+1\n\nn,m = list(map(int,input().split()))\ngakusei = []\nfor i in range(n):\n    x,y = list(map(int,input().split()))\n    gakusei.append([x,y])\ncheckpoint = []\nfor j in range(m):\n    x,y = list(map(int,input().split()))\n    checkpoint.append([x,y])\n\n#print(gakusei,checkpoint)\nfor i in range(n):\n    print((f(gakusei[i][0],gakusei[i][1])))\n\n", "passed": true, "time": 0.2, "memory": 14220.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nP = [list(map(int,input().split())) for _ in range(n)]\nC = [list(map(int,input().split())) for _ in range(m)]\n\nfor i in range(n):\n  d = 10**18\n  t = 0\n  for j in range(m):\n    dist = abs(P[i][0]-C[j][0]) + abs(P[i][1]-C[j][1])\n    if d > dist:\n      t = j\n      d = dist\n  print(t+1)", "passed": true, "time": 0.24, "memory": 14208.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\na = []; b = []; c = []; d = []\n\nfor i in range(N):\n    x, y = list(map(int, input().split()))\n    a.append(x)\n    b.append(y)\nfor i in range(M):\n    x, y = list(map(int, input().split()))\n    c.append(x)\n    d.append(y)\n\nfor i in range(N):\n    m = abs(a[i] - c[0]) + abs(b[i] - d[0])\n    p = 0\n    for j in range(1, M):\n        if m > abs(a[i] - c[j]) + abs(b[i] - d[j]):\n            m = abs(a[i] - c[j]) + abs(b[i] - d[j])\n            p = j\n    print((p + 1))\n", "passed": true, "time": 0.15, "memory": 14328.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na = [0] *n\nb = [0] *n\nc = [0] *m\nd = [0] *m\nfor i in range(n):\n    a[i], b[i] = map(int, input().split())\nfor j in range(m):\n    c[j], d[j] = map(int, input().split())\n\nans = []\n\n\n\nfor i in range(n):\n    judge = 10 ** 9\n    num = 0\n    for j in range(m):\n        if judge > abs(a[i]-c[j])+abs(b[i]-d[j]):\n            judge = abs(a[i]-c[j])+abs(b[i]-d[j])\n            num = j+1\n    ans.append(num)\n#print(ans)\nfor i in ans:\n    print(i)", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "import itertools\nurl = \"https://atcoder.jp//contests/abc057/tasks/abc057_a\"\n\ndef main():\n    n, m = list(map(int, input().split()))\n    ab = [list(map(int, input().split())) for _ in range(n)]\n    cd = [list(map(int, input().split())) for _ in range(m)]\n    for i in range(len(ab)):\n        dist = []\n        for k in range(len(cd)):\n            tmp = abs(ab[i][0] - cd[k][0]) + abs(ab[i][1] - cd[k][1])\n            dist.append(tmp)\n        print(dist.index(min(dist)) + 1)\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.27, "memory": 14284.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nst = []\nco = []\nfor i in range(n):\n  a,b = map(int,input().split())\n  st.append([a,b])\nfor i in range(m):\n  c,d = map(int,input().split())\n  co.append([c,d])\nfor a,b in st:\n  tmp = 10**9\n  output = 0\n  for i in range(m):\n    if tmp > (new:=abs(a-co[i][0])+abs(b-co[i][1])):\n      output = i+1\n      tmp = new\n  print(output)  ", "passed": true, "time": 1.52, "memory": 14144.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na = [0] * n\nb = [0] * n\nfor i in range(n):\n    a[i], b[i] = map(int, input().split())\nc = [0] * m\nd = [0] * m\nfor j in range(m):\n    c[j], d[j] = map(int, input().split())\nfor i in range(n):\n    e = []\n    for j in range(m):\n        e.append(abs(a[i] - c[j]) + abs(b[i] - d[j]))\n    f = e.index(min(e))\n    print(f + 1)", "passed": true, "time": 0.15, "memory": 14140.0, "status": "done"}, {"code": "n, m = map(int, input().split())\ns_pos = []\nc_pos = []\n\nfor i in range(n):\n    a, b = map(int, input().split())\n    s_pos.append([a, b])\n\nfor i in range(m):\n    c, d = map(int, input().split())\n    c_pos.append([c, d])\n\nfor i in range(n):\n    min_dist = 10 ** 16\n    c_index = 0\n    for j in range(m):\n        dist = abs(s_pos[i][0] - c_pos[j][0]) + abs(s_pos[i][1] - c_pos[j][1])\n        if dist < min_dist:\n            min_dist = dist\n            c_index = j + 1\n    print(c_index)", "passed": true, "time": 0.24, "memory": 14072.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nab = list(list(map(int, input().split())) for _ in range(n))\ncd = list(list(map(int, input().split())) for _ in range(m))\n\nfor j in range(n):\n    a, b = ab[j][0], ab[j][1]\n    ans, res = 0, 1001001001\n    for i in range(m):\n        c, d = cd[i][0], cd[i][1]\n        if abs(a-c)+abs(b-d) < res:\n            res = abs(a-c)+abs(b-d)\n            ans = i+1\n    print(ans)", "passed": true, "time": 0.15, "memory": 14260.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\nX = []\nfor i in range(N):\n    x = list(map(int, input().split()))\n    X.append(x)\nY = []\nfor i in range(M):\n    y = list(map(int, input().split()))\n    Y.append(y)\n\n\nfor i in X:\n    len = []\n    for j in Y:\n        len.append(abs(i[0]-j[0])+abs(i[1]-j[1]))\n    print((len.index(min(len))+1))\n", "passed": true, "time": 0.26, "memory": 14240.0, "status": "done"}, {"code": "#\n# abc057 b\n#\n\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n    def assertIO(self, input, output):\n        stdout, stdin = sys.stdout, sys.stdin\n        sys.stdout, sys.stdin = StringIO(), StringIO(input)\n        resolve()\n        sys.stdout.seek(0)\n        out = sys.stdout.read()[:-1]\n        sys.stdout, sys.stdin = stdout, stdin\n        self.assertEqual(out, output)\n\n    def test_\u5165\u529b\u4f8b_1(self):\n        input = \"\"\"2 2\n2 0\n0 0\n-1 0\n1 0\"\"\"\n        output = \"\"\"2\n1\"\"\"\n        self.assertIO(input, output)\n\n    def test_\u5165\u529b\u4f8b_2(self):\n        input = \"\"\"3 4\n10 10\n-10 -10\n3 3\n1 2\n2 3\n3 5\n3 5\"\"\"\n        output = \"\"\"3\n1\n2\"\"\"\n        self.assertIO(input, output)\n\n    def test_\u5165\u529b\u4f8b_3(self):\n        input = \"\"\"5 5\n-100000000 -100000000\n-100000000 100000000\n100000000 -100000000\n100000000 100000000\n0 0\n0 0\n100000000 100000000\n100000000 -100000000\n-100000000 100000000\n-100000000 -100000000\"\"\"\n        output = \"\"\"5\n4\n3\n2\n1\"\"\"\n        self.assertIO(input, output)\n\n\ndef resolve():\n    N, M = list(map(int, input().split()))\n    S = [list(map(int, input().split())) for _ in range(N)]\n    C = [list(map(int, input().split())) for _ in range(M)]\n\n    ans = []\n    for s in S:\n        D = float(\"inf\")\n        t = 0\n        for i in range(M):\n            d = abs(s[0]-C[i][0]) + abs(s[1]-C[i][1])\n            if d < D:\n                D = d\n                t = i\n        ans.append(t+1)\n\n    for a in ans:\n        print(a)\n\n\ndef __starting_point():\n    # unittest.main()\n    resolve()\n\n__starting_point()", "passed": true, "time": 0.16, "memory": 14556.0, "status": "done"}, {"code": "n,m=list(map(int,input().split()))\n\nstudents=[]\nfor _ in range(n):\n    students.append(list(map(int,input().split())))\n\nchecks=[]\nfor _ in range(m):\n    checks.append(list(map(int,input().split())))\n\nfor student in students:\n    index = 1\n    min = 10**8*4\n    for i,check in enumerate(checks,1):\n        tmp=abs(student[0]-check[0])+abs(student[1]-check[1])\n        if min>tmp:\n            min=tmp\n            index=i\n    print(index)\n", "passed": true, "time": 0.14, "memory": 14356.0, "status": "done"}, {"code": "n,m = map(int,input().split())\na = [list(map(int,input().split())) for i in range(n)]\nb = [list(map(int,input().split())) for i in range(m)]\nfor i in range(n):\n    c = float(\"inf\")\n    e = 0\n    g = 0\n    for j in range(m):\n        d = abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])\n        g+=1\n        if d <c:\n            c,e=d,g\n    print(e)", "passed": true, "time": 0.23, "memory": 14260.0, "status": "done"}, {"code": "N,M = [int(c) for c in input().split()]\nab = [list(map(int,input().split())) for c in range(N)]\ncd = [list(map(int,input().split())) for c in range(M)]\nfor i in range(N):\n    mi = 2*10**9\n    for j in range(M):\n        tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n        if mi > tmp:\n            mi = tmp\n            ans = j+1\n    print(ans)\n", "passed": true, "time": 0.15, "memory": 14352.0, "status": "done"}, {"code": "n,m=list(map(int,input().split()))\nl_n=[list(map(int,input().split())) for _ in range(n)]\nl_m=[list(map(int,input().split())) for _ in range(m)]\n# print(l_n,l_m)\n\n\nfor i,j in l_n:\n    distance=0\n    cnt = 0\n    ans = float ( \"inf\" )\n    for k,l in enumerate(l_m,1):\n        a,b=l\n        distance=abs(i-a)+abs(j-b)\n        if ans>distance:\n            ans=min(ans,distance)\n            cnt=k\n    print(cnt)\n", "passed": true, "time": 0.15, "memory": 14196.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nst = []\ncp = []\nfor i in range(n):\n    st.append(list(map(int, input().split())))\nfor i in range(m):\n    cp.append(list(map(int, input().split())))\n\nfor i in range(n):\n    distance = 0\n    shortest_cp = 0\n    for j in range(m):\n        if j == 0:\n            distance = 1\n            shortest_cp = abs(st[i][0]-cp[j][0]) + abs(st[i][1]-cp[j][1])\n        else:\n            if (abs(st[i][0]-cp[j][0]) + abs(st[i][1]-cp[j][1])) < shortest_cp:\n                distance = j + 1\n                shortest_cp = abs(st[i][0]-cp[j][0]) + abs(st[i][1]-cp[j][1])\n                \n    print(distance)", "passed": true, "time": 0.14, "memory": 14320.0, "status": "done"}, {"code": "import sys\nimport math\nimport itertools\nimport collections\nfrom collections import deque\nfrom collections import defaultdict\n\nsys.setrecursionlimit(1000000)\nMOD = 10 ** 9 + 7\nMOD2 = 998244353\nINF = float('inf')\ninput = lambda: sys.stdin.readline().strip()\n\nNI = lambda: int(input())\nNMI = lambda: map(int, input().split())\nNLI = lambda: list(NMI())\nSI = lambda: input()\n\ndef main():\n    \n    N, M = NMI()\n    AB = [NLI() for _ in range(N)]\n    CD = [NLI() for _ in range(M)]    \n\n    \n    for n in range(N):\n        A = AB[n][0]\n        B = AB[n][1]\n        \n        distance = []\n        for m in range(M):\n            C = CD[m][0]\n            D = CD[m][1]\n            distance.append(abs(A-C)+abs(B-D))\n            \n        print(distance.index(min(distance))+1)\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.15, "memory": 14412.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nab = [list(map(int, input().split())) for _ in range(N)]\ncd = [list(map(int, input().split())) for _ in range(M)]\nfor i in range(N):\n    ans = -1\n    dist = 10**12\n    for j in range(M):\n        tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]) \n        if tmp < dist:\n            ans = j\n            dist = tmp\n    print(ans+1)", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nlx = []\nly = []\n\nfor i in range(n + m):\n    x, y = list(map(int, input().split()))\n    lx.append(x)\n    ly.append(y)\n\nfor i in range(n):\n    r = []\n    for j in range(n, m + n):\n        r.append(abs(lx[i] - lx[j]) + abs(ly[i] - ly[j]))\n    print((r.index(min(r)) + 1))\n", "passed": true, "time": 0.14, "memory": 14380.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nal = [list(map(int, input().split())) for _ in range(n)]\ncl = [list(map(int, input().split())) for _ in range(m)]\n\nfor a in al:\n    ans, dis = 0, 1001001001\n    for i in range(m):\n        _dis = abs(a[0]-cl[i][0]) + abs(a[1]-cl[i][1])\n        if _dis < dis:\n            ans, dis = i+1, _dis\n    print(ans)\n", "passed": true, "time": 0.25, "memory": 14396.0, "status": "done"}, {"code": "n, m = [int(x) for x in input().split()]\na = []\nfor i in range(n):\n  a.append([int(x) for x in input().split()])\nc = []\nfor i in range(m):\n  c.append([int(x) for x in input().split()])\n\nfor i in range(n):\n  d = 10 ** 9\n  cc = 0\n  for j in range(m):\n    di = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1])\n    if di < d:\n      d = di\n      cc = j\n  print(cc + 1)", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "n,m=map(int, input().split())\nab=[list(map(int,input().split())) for i in  range(n)]\ncd=[list(map(int,input().split())) for i in  range(m)]\nfor i in range(n):\n  Min=4*(10**8)+1\n  for j in range(m):\n    d = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1]-cd[j][1])\n    #print(d,ab[i][0],cd[j][0])\n    if Min > d:\n      Min = d\n      ans = j+1\n  print(ans)", "passed": true, "time": 0.14, "memory": 14388.0, "status": "done"}, {"code": "n,m=list(map(int,input().split()))\nstudent=[]\nfor _ in range(n):\n    a,b=list(map(int,input().split()))\n    student.append([a,b])\n\ncheckpoint =[]\nfor _ in range(m):\n    c,d = list(map(int,input().split()))\n    checkpoint.append([c,d])\n\nfor i in range(n):\n    s = student[i]\n    dist = float('inf')\n\n    num=0\n    for j in range(m):\n        c=checkpoint[j]\n        tmp = abs(s[0]-c[0]) + abs(s[1]-c[1])\n\n        if tmp < dist:\n            dist = tmp\n            num=j+1\n\n    print(num)\n        \n", "passed": true, "time": 0.14, "memory": 14400.0, "status": "done"}, {"code": "n,m=list(map(int,input().split()))\nl_n=[list(map(int,input().split())) for _ in range(n)]\nl_m=[list(map(int,input().split())) for _ in range(m)]\n# print(l_n,l_m)\n\n\nfor i,j in l_n:\n    distance=0\n    cnt = 0\n    ans = float ( \"inf\" )\n    for k,l in enumerate(l_m):\n        a,b=l\n        distance=abs(i-a)+abs(j-b)\n        if ans>distance:\n            ans=min(ans,distance)\n            cnt=k+1\n    print(cnt)\n", "passed": true, "time": 0.14, "memory": 14320.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nX = [tuple(map(int, input().split())) for _ in range(n)]\nY = [tuple(map(int, input().split())) for _ in range(m)]\n\n\nfor x in X:\n    d1 = sum(x)\n    d2 = x[0] - x[1]\n    z = 10 ** 9\n    for i, y in enumerate(Y, 1):\n        D1 = sum(y)\n        D2 = y[0] - y[1]\n        Z = max(abs(D1 - d1), abs(D2 - d2))\n        if z > Z:\n            z = Z\n            ans = i\n    print(ans)\n", "passed": true, "time": 0.15, "memory": 14152.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nstudent = [list(map(int, input().split())) for i in range(N)]\ncheck = [list(map(int, input().split())) for i in range(M)]\n\ntmp = []\nfor i in range(len(student)):\n    for j in range(len(check)):\n        x = abs(student[i][0] - check[j][0])\n        y = abs(student[i][1] - check[j][1])\n        tmp.append(x+y)\n    print(tmp.index(min(tmp))+1)\n    tmp = []", "passed": true, "time": 0.15, "memory": 14172.0, "status": "done"}, {"code": "N, M = map(int, input().split())\n\n# \u5b66\u751fN\u4eba\u306e\u73fe\u5728\u5730(a,b)\nA_B = [list(map(int, input().split())) for _ in range(N)]\n# \u30c1\u30a7\u30c3\u30af\u30dd\u30a4\u30f3\u30c8M\u500b\u306e\u5834\u6240(c,d)\nC_D = [list(map(int, input().split())) for _ in range(M)]\n\n\nfor a, b in A_B:\n    temp_distance = 10**10\n    temp_checkpoint = -1\n    checkpoint_count = 1\n    for c, d in C_D:\n        manhattan_distance = abs(a-c) + abs(b-d)\n        if temp_distance > manhattan_distance:\n            temp_distance = manhattan_distance\n            temp_checkpoint = checkpoint_count\n        checkpoint_count += 1\n    print(temp_checkpoint)", "passed": true, "time": 0.24, "memory": 14260.0, "status": "done"}, {"code": "N, M = map(int, input().split())\na = []\nc = []\nfor i in range(N):\n  x, y = map(int, input().split())\n  a.append([x, y])\nfor i in range(M):\n  x, y = map(int, input().split())\n  c.append([x, y])\n\nfor i in a:\n  tmp = 10**9\n  for l in range(M):\n    j = c[l]\n    x = abs(i[0]-j[0]) + abs(i[1]-j[1])\n    if tmp > x:\n      tmp = x\n      ans = l + 1\n  print(ans)", "passed": true, "time": 0.15, "memory": 14180.0, "status": "done"}, {"code": "n,m = map(int, input().split())\nab = [list(map(int, input().split())) for _ in range(n)]\ncd = [list(map(int, input().split())) for _ in range(m)]\n\nfor a,b in ab:\n    ans = []\n    for c,d in cd:\n        ans.append(abs(a-c)+abs(b-d))\n    print(ans.index(min(ans))+1)", "passed": true, "time": 0.15, "memory": 14084.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nab = [list(map(int, input().split())) for p in range(n)]\ncd = [list(map(int, input().split())) for q in range(m)]\nfor i in range(n):\n    x = 10**10\n    ans = 0\n    for j in range(m):\n        if abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]) < x:\n            ans = j+1\n            x = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n    print(ans)", "passed": true, "time": 0.25, "memory": 14004.0, "status": "done"}, {"code": "n,m=map(int,input().split())\ns=[list(map(int,input().split())) for _ in range(n)]\nc=[list(map(int,input().split())) for _ in range(m)]\nwhere=[]\nfor i in range(n):\n    distance=10**9\n    for j in range(m):\n        if distance>abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1]):\n            distance=abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1])\n            w=j\n    where.append(w+1)\n[print(i) for i in where]", "passed": true, "time": 0.24, "memory": 14152.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nstu = []\nche = []\nkyori = []\nans = []\nfor _ in range(n):\n  stu.append(list(map(int,input().split())))\nfor _ in range(m):\n  che.append(list(map(int,input().split())))\nfor x in range(n):\n  for y in range(m):\n    kyori.append(abs(stu[x][0]-che[y][0])+abs(stu[x][1]-che[y][1]))\n  z = min(kyori)\n  ans.append(kyori.index(z)+1)\n  kyori = []\nfor i in range(len(ans)):\n  print(ans[i])", "passed": true, "time": 0.15, "memory": 14324.0, "status": "done"}, {"code": "n, m = map(int, input().split())\ns = [list(map(int, input().split())) for _ in range(n)]\nc = [list(map(int, input().split())) for _ in range(m)]\nans = []\nINF = 10**9+7\nfor x in s:\n  d = INF\n  ind = INF\n  for i,y in enumerate(c):\n    exd = d\n    d = min(d,abs(x[0]-y[0])+abs(x[1]-y[1]))\n    if d != exd:\n      ind = i\n  ans.append(ind+1)\nfor x in ans:\n  print(x)", "passed": true, "time": 0.15, "memory": 14132.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\n\nP = []\nfor _ in range(N):\n    a, b = list(map(int, input().split()))\n    P.append([a, b])\n\nC = []\nfor _ in range(M):\n    c, d = list(map(int, input().split()))\n    C.append([c, d])\n\nfor i in range(N):\n    ans = float('inf')\n    num = float('inf')\n    for j in range(M):\n        if num > abs(P[i][0] - C[j][0]) + abs(P[i][1] - C[j][1]):\n            num = abs(P[i][0] - C[j][0]) + abs(P[i][1] - C[j][1])\n            ans = j + 1\n\n    print(ans)\n", "passed": true, "time": 0.16, "memory": 14204.0, "status": "done"}, {"code": "n,m=list(map(int,input().split()))\n\na_lis=[list(map(int,input().split())) for i in range(n)]\nc_lis=[list(map(int,input().split())) for i in range(m)]\n\nfor i in range(n):\n  num=0\n  ans=10**10\n  for j in reversed(list(range(m))):\n    a=a_lis[i]\n    c=c_lis[j]\n    num=abs(a[0]-c[0])+abs(a[1]-c[1])\n    ans=min(ans,num)\n    if num==ans:\n      cnt=j+1\n  print(cnt)\n    \n", "passed": true, "time": 0.19, "memory": 14288.0, "status": "done"}, {"code": "n,m=list(map(int,input().split()))\na=[list(map(int,input().split())) for _ in range(n)]\nb=[list(map(int,input().split())) for _ in range(m)]\nfor i in range(n):\n    ans=-1\n    num=10**10\n    for j in range(m):\n        cnt=abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])\n        if cnt<num:\n            ans=j+1\n            num=cnt\n    print(ans)\n", "passed": true, "time": 0.25, "memory": 14160.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nstudents = [list(map(int, input().split())) for i in range(n)]\n\ntargets = [list(map(int, input().split())) for i in range(m)]\nx = 0\nsnumber = [(0, x)] * n\n  \ndef md(s, t):\n  d = abs(s[0] - t[0]) + abs(s[1] - t[1])\n  return d\n\nfor i in range(n):\n  x = 4 * 10 ** 8\n  for j in range(m):    \n    if x > md(students[i], targets[j]):\n      x = md(students[i], targets[j])\n      snumber[i] = (j+1, md(students[i], targets[j]))\n      \nfor i in range(n):      \n  print(snumber[i][0])", "passed": true, "time": 0.24, "memory": 14388.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nal = list(list(map(int, input().split())) for _ in range(n))\ncl = list(list(map(int, input().split())) for _ in range(m))\n\nfor a in al:\n    ans = 1001001001\n    no = 0\n    for i in range(m):\n        dis = abs(a[0]-cl[i][0])+abs(a[1]-cl[i][1])\n        if dis < ans:\n            ans = dis\n            no = i\n    print((no+1))\n", "passed": true, "time": 0.22, "memory": 14336.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nab = [tuple(map(int, input().split())) for _ in range(N)]\ncd = [tuple(map(int, input().split())) for _ in range(M)]\n\nfor a, b in ab:\n    check_point_dist = 10 ** 8 * 4 + 1\n    check_point = 0\n    count = 0\n    for c, d in cd:\n        count += 1\n        if check_point_dist > abs(a - c) + abs(b - d):\n            check_point = count\n            check_point_dist = abs(a - c) + abs(b - d)\n    else:\n        print(check_point)", "passed": true, "time": 0.15, "memory": 14280.0, "status": "done"}, {"code": "N, M = list(map(int,input().split()))\nstu = []\nche = []\nfor i in range(N):\n    ab = list(map(int,input().split()))\n    stu.append(ab)\nfor i in range(M):\n    cd = list(map(int,input().split()))\n    che.append(cd)\nans = 0\ndis = 0\nx = 5 * 10 ** 8\n\nfor i in range(N):\n    for j in range(M):\n        dis = abs(stu[i][0] - che[j][0]) + abs(stu[i][1] - che[j][1])\n        \n        if dis < x:\n            x = dis\n            ans = j + 1\n        \n\n    print(ans)\n    x = 5 * 10 ** 8\n", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "import sys\n\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\ns = []\nfor _ in range(N):\n    a, b = map(int, input().split())\n    s.append((a, b))\n\ng = []\nfor _ in range(M):\n    c, d = map(int, input().split())\n    g.append((c, d))\n\nans = []\nfor i in range(N):\n    a, b = s[i]\n    i_ans = -1\n    tmp = float(\"inf\")\n    for j in range(M):\n        c, d = g[j]\n        dist = abs(c-a) + abs(d-b)\n        # print(i, j, dist)\n        if dist < tmp:\n            i_ans = j\n            tmp = dist\n    ans.append(i_ans)\n\nfor a in ans:\n    print(a+1)", "passed": true, "time": 0.23, "memory": 14308.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nab = [list(map(int, input().split())) for _ in range(n)]\ncd = [list(map(int, input().split())) for _ in range(m)]\n\nans = []\nfor i in range(n):\n    dis = []\n    for j in range(m):\n        dis.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]))\n    ans.append(dis.index(min(dis)) + 1)\nfor i in ans:\n    print(i)", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "n, m = map(int, input().split())\n\ns = [tuple(map(int, input().split())) for _ in range(n)]\nc = [tuple(map(int, input().split())) for _ in range(m)]\n\nfor a, b in s:\n    d = float('inf')\n    for i in range(m):\n        x, y = c[i]\n        if abs(a - x) + abs(b - y) < d:\n            d = abs(a - x) + abs(b - y)\n            ans = i + 1\n    print(ans)", "passed": true, "time": 0.16, "memory": 14252.0, "status": "done"}, {"code": "N, M = map(int,input().split())\nstudents = []\npoints = []\nfor _ in range(N):\n    students.append(list(map(int,input().split())))\nfor _ in range(M):\n    points.append(list(map(int,input().split())))\n\nfor i in range(N):\n    MIN = 10 ** 10\n    index = -1\n    for j in range(M):\n        if MIN > abs(students[i][0] - points[j][0]) + abs(students[i][1] - points[j][1]):\n            MIN = abs(students[i][0] - points[j][0]) + abs(students[i][1] - points[j][1])\n            index = j\n    print(index + 1)", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nstu = []\ncheckpoints = []\nfor _ in range(n):\n    ab = list(map(int, input().split()))\n    stu.append(list(ab))\nfor _ in range(m):\n    cd = list(map(int, input().split()))\n    checkpoints.append(list(cd))\n\nfor s in stu:\n    checkpoint_id = 1010101\n    manhatttaaann_dis = 2 * (10**18) + 101010101\n    for i, cp in enumerate(checkpoints):\n        dist = abs(s[0] - cp[0]) + abs(s[1] - cp[1])\n        if dist < manhatttaaann_dis:\n            manhatttaaann_dis = dist\n            checkpoint_id = i\n    print((checkpoint_id + 1))\n", "passed": true, "time": 0.23, "memory": 14300.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nal = []\nbl = []\nfor i in range(n):\n    a, b = map(int, input().split())\n    al.append([a, b])\nfor j in range(m):\n    c, d = map(int, input().split())\n    bl.append([c,d])\n\ndef check(a,b):\n    x = a[0] - b[0]\n    y = a[1] - b[1]\n    if x < 0:\n        x = -x\n    if y < 0:\n        y = -y\n    return x + y\n\nfor a in al:\n    min = 1000000000\n    cnt = 1\n    for b in bl:\n        tmp = check(a,b)\n        if tmp < min:\n            ans = cnt\n            min = tmp\n        cnt += 1\n    print(ans)", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "N,M=list(map(int,input().split()))\nab=[[int(x) for x in input().split()] for _ in range(N)]\ncd=[[int(x) for x in input().split()] for _ in range(M)]\n\nfor a,b in ab:\n  ans=list()\n  for c,d in cd:\n    ans.append(abs(a-c)+abs(b-d))\n  print((ans.index(min(ans))+1))\n", "passed": true, "time": 0.14, "memory": 14196.0, "status": "done"}, {"code": "n, m = map(int, input().split())\n\nstudent = [None]*n\nfor i in range(n):\n  student[i] = tuple(map(int, input().split()))\n\npoint = [None]*m\nfor i in range(m):\n  point[i] = tuple(map(int, input().split()))\n\nfor i in range(n):\n  dist = pow(10, 9)\n  ans = 0\n  x, y = student[i]\n  for j in range(m):\n    sub = abs(point[j][0]-x) + abs(point[j][1]-y)\n    if dist > sub:\n      dist = sub\n      ans = j+1\n  print(ans)", "passed": true, "time": 0.15, "memory": 14316.0, "status": "done"}, {"code": "n, m  = list(map(int, input().split()))\npos = []\ncheck = []\nfor i in range(n):\n  a, b  = list(map(int, input().split()))\n  pos.append([a, b])\n\nfor i in range(m):\n  c, d  = list(map(int, input().split()))\n  check.append([c, d])\n\nfor i in range(n):\n  ans = 0\n  k = 10**9\n  for j in range(m):\n    t = abs(pos[i][0] - check[j][0]) + abs(pos[i][1] - check[j][1])\n    if k > t:\n      k = t\n      ans = j + 1\n  print(ans)\n", "passed": true, "time": 0.15, "memory": 14120.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na = [0] * n\nb = [0] * n\nc = [0] * m\nd = [0] * m\nfor i in range(n):\n    a[i], b[i] = map(int, input().split())\nfor i in range(m):\n    c[i], d[i] = map(int, input().split())\n\nfor i in range(n):\n    dist = abs(a[i]-c[0])+abs(b[i]-d[0])\n    point = 1\n    for j in range(1, m):\n        if dist > (abs(a[i]-c[j])+abs(b[i]-d[j])):\n            dist = (abs(a[i]-c[j])+abs(b[i]-d[j]))\n            point = j+1\n    print(point)", "passed": true, "time": 0.15, "memory": 14212.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\na, b, c, d = [], [], [], []\nfor _ in range(n):\n  an, bn = list(map(int, input().split()))\n  a.append(an)\n  b.append(bn)\nfor _ in range(m):\n  cn, dn = list(map(int, input().split()))\n  c.append(cn)\n  d.append(dn)\n  \ndef dist(x1, y1, x2, y2):\n  return abs(x1-x2)+abs(y1-y2)\n\nfor i in range(n):\n  minimum = 10**9\n  min_id = 0\n  for j in range(m):\n    ds = dist(a[i], b[i], c[j], d[j])\n    if ds < minimum:\n      minimum = ds\n      min_id = j\n  print((min_id+1))\n", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "from sys import stdin, stdout # only need for big input\n\ndef manhattan_distance(p1, p2):\n    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])\n\ndef solve():\n    n, m = list(map(int, input().split()))\n    students = []\n    check_points = []\n\n    for _ in range(n):\n        a, b = list(map(int, input().split()))\n        students.append((a,b))\n    \n    for _ in range(m):\n        c, d = list(map(int, input().split()))\n        check_points.append((c,d))\n    \n    for s in students:\n        cur_closest_dist = int(4e8)\n        cur_closest_point = -1 \n        for i in range(m):\n            c = check_points[i]\n            if manhattan_distance(s, c) < cur_closest_dist:\n                cur_closest_dist = manhattan_distance(s,c)\n                cur_closest_point = i \n        print(cur_closest_point + 1)\n\n\ndef main():\n    solve()\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14348.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nP = [list(map(int,input().split())) for _ in range(n)]\nC = [list(map(int,input().split())) for _ in range(m)]\n\nfor i in range(n):\n  min_dist = 10**18\n  idx = 0\n  for j in range(m):\n    dist = abs(P[i][0]-C[j][0]) + abs(P[i][1]-C[j][1])\n    if min_dist > dist:\n      idx = j + 1\n      min_dist = dist\n  print(idx)", "passed": true, "time": 0.24, "memory": 14220.0, "status": "done"}, {"code": "n,m = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(n)]\ncd = [list(map(int, input().split())) for _ in range(m)]\n\ndef distance(x,y,i,j):\n    return abs(x-i) + abs(y-j)\n\nfor a,b in ab:\n    # \u5404\u30c1\u30a7\u30c3\u30af\u30dd\u30a4\u30f3\u30c8\u3068\u306e\u8ddd\u96e2\n    dists = [distance(a, b, c, d) for c,d in cd]\n    print(dists.index(min(dists)) + 1)", "passed": true, "time": 0.15, "memory": 14280.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nsd = []\ncp = []\n\nfor i in range(n):\n  sd.append([int(j) for j in input().split()])\nfor i in range(m):\n  cp.append([int(j) for j in input().split()])  \n  \ndist = [[0 for i in range(m)] for j in range(n)]\n\nfor i in range(n):\n  for j in range(m):\n    dist[i][j] = abs(sd[i][0] - cp[j][0]) + abs(sd[i][1] - cp[j][1])\n    \nfor i in range(n):\n  print(dist[i].index(min(dist[i]))+1)", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "def distance(coordinate1, coordinate2):\n    x1 = coordinate1[0]\n    y1 = coordinate1[1]\n    x2 = coordinate2[0]\n    y2 = coordinate2[1]\n    return abs(x1 - x2) + abs(y1 - y2)\n\n\ndef main():\n    n, m = map(int, input().split())\n    ab_lst = [list(map(int, input().split())) for _ in range(n)]\n    cd_lst = [list(map(int, input().split())) for _ in range(m)]\n    point_lst = []\n\n    for i in range(n):\n\n        distance_lst = []\n        for j in range(m):\n\n            coordinate1 = ab_lst[i]\n            coordinate2 = cd_lst[j]\n            distance_lst.append(distance(coordinate1, coordinate2))\n\n        minimum = min(distance_lst)\n        for k in range(m):\n            if distance_lst[k] == minimum:\n                point_lst.append(k + 1)\n                break\n\n    for i in range(n):\n        print(point_lst[i])\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14488.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\n\nn, m = map(int, input().split())\nab = []\ncd = []\nfor _ in range(n):\n    a, b = map(int, input().split())\n    ab.append((a, b))\nfor _ in range(m):\n    c, d = map(int, input().split())\n    cd.append((c, d))\nans = []\nfor a, b in ab:\n    t = 10**18\n    checkpoint = -1\n    for i, cdi in enumerate(cd):\n        c, d = cdi\n        dist = abs(a-c)+abs(b-d)\n        if dist < t:\n            t = dist\n            checkpoint = (i+1)\n    ans.append(checkpoint)\nprint(*ans, sep='\\n')\n", "passed": true, "time": 0.15, "memory": 14368.0, "status": "done"}, {"code": "#from statistics import median\n#import collections\n#aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\nfrom math import gcd\nfrom itertools import combinations,permutations,accumulate, product # (string,3) 3\u56de\n#from collections import deque\nfrom collections import deque,defaultdict,Counter\nimport decimal\nimport re\nimport math\nimport bisect\nimport heapq\n#\n#\n#\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n#\n#\n# my_round_int = lambda x:np.round((x*2 + 1)//2)\n# \u56db\u6368\u4e94\u5165g\n#\n# \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u7cfb\n# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);\n# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);\n#\n#\nimport sys\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n#mod = 9982443453\n#mod = 998244353\nINF = float('inf')\nfrom sys import stdin\nreadline = stdin.readline\ndef readInts():\n  return list(map(int,readline().split()))\ndef readTuples():\n    return tuple(map(int,readline().split()))\ndef I():\n    return int(readline())\nn,m = readInts()\nN = [readInts() for _ in range(n)]\nM = [readInts() for _ in range(m)]\nfor a,b in N:\n    pos = INF\n    ans = None\n    for i,(x,y) in enumerate(M):\n        if abs(a-x) + abs(b-y) < pos:\n            pos = abs(a-x)+abs(b-y)\n            ans = i+1\n    print(ans)\n", "passed": true, "time": 0.18, "memory": 14392.0, "status": "done"}, {"code": "n, m = map(int,input().split())\n\nab = []\nfor i in range(n):\n    ab.append(list(map(int, input().split())))\n    \ncd = []\nfor i in range(m):\n    cd.append(list(map(int, input().split())))\n\nans = [0] * m\nfor i in range(n):\n    a, b = ab[i][0], ab[i][1]\n    dist = [0] * m\n    for j in range(m):\n        dist[j] = abs(a - cd[j][0]) + abs(b - cd[j][1])\n    dm = min(dist)\n    for j in range(m):\n        if dist[j] == dm:\n            print(j+1)\n            break", "passed": true, "time": 0.23, "memory": 14272.0, "status": "done"}, {"code": "from typing import List\n\n\ndef manhattan_distance(student: List[int], check_point: List[int]) -> int:\n    return abs(check_point[0] - student[0]) + abs(check_point[1] - student[1])\n\n\ndef answer(n: int, m: int, students: List[List[int]], check_points: List[List[int]]) -> str:\n    students_destination = []\n    for student in students:\n        mds = {}\n        for i, check_point in enumerate(check_points, start=1):\n            md = manhattan_distance(student, check_point)\n            if md not in list(mds.keys()):\n                mds[md] = str(i)\n        students_destination.append(mds[min(mds.keys())])\n\n    return '\\n'.join(students_destination)\n\n\ndef main():\n    n, m = list(map(int, input().split()))\n    ab = [list(map(int, input().split())) for _ in range(n)]\n    cd = [list(map(int, input().split())) for _ in range(m)]\n    print((answer(n, m, ab, cd)))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.26, "memory": 15484.0, "status": "done"}, {"code": "def LI():\n    return list(map(int, input().split()))\n\n\ndef LIHW(h):\n    return [list(map(int, input().split())) for _ in range(h)]\n\n\nN, M = LI()\nNlist = LIHW(N)\nMlist = LIHW(M)\nanslist = [0]*N\nfor i in range(N):\n    a, b = Nlist[i]\n    ans = 10**9\n    for j in range(M):\n        c, d = Mlist[j]\n        kyori = abs(c-a)+abs(d-b)\n        if ans > kyori:\n            ansind = j+1\n            ans = kyori\n    anslist[i] = ansind\n\nfor i in range(N):\n    print((anslist[i]))\n", "passed": true, "time": 0.14, "memory": 14380.0, "status": "done"}, {"code": "import math\nimport collections\nfrom itertools import product\n\nii = lambda : int(input())\nmi = lambda : map(int,input().split())\nli = lambda : list(map(int,input().split()))\n\nn,m  = mi()\nab = [li() for _ in range(n)]\ncd = [li() for _ in range(m)]\n\nfor i in range(n):\n    length = 10**10\n    ans = 0\n    for j in range(m):\n        if abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]) < length:\n            length = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n            ans = j\n    print(ans+1)", "passed": true, "time": 0.15, "memory": 14396.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nstu = []\nfor v in range(N):\n    ai,bi = map(int,input().split())\n    stu.append((v,ai,bi))\ncp = []\nfor w in range(M):\n    ci,di = map(int,input().split())\n    cp.append((w,ci,di))\n#\u5927\u304d\u3044\u756a\u53f7\u304b\u3089\u8abf\u3079\u308b\u3053\u3068\u3067\u540c\u3058\u5024\u306e\u3068\u304d\u6700\u5c0f\u306e\u30c1\u30a7\u30c3\u30af\u30dd\u30a4\u30f3\u30c8\u306b\u884c\u3051\u308b\ncp = cp[::-1]\nans = [0]*N\n#\u3042\u308b\u5b66\u751f\u306b\u3064\u3044\u3066    \nfor i,x,y in stu:\n    #\u3042\u308b\u30c1\u30a7\u30c3\u30af\u30dd\u30a4\u30f3\u30c8\u306b\u3064\u3044\u3066\n    mindist = 10**16\n    cp_num = 0\n    for j,k,l in cp:\n        dist = abs(x-k) + abs(y-l)\n        if mindist >= dist:\n            mindist = dist\n            cp_num = j+1\n    ans[i] = cp_num\nfor n in ans:\n    print(n)", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "n, m = map(int, input().split())\na = [list(map(int, input().split())) for _ in range(n)]\nb = [list(map(int, input().split())) for _ in range(m)]\n\nfor i in range(n):\n    shortest = 4*10**8 + 5\n    for j in range(m):\n        distance = abs(a[i][0] - b[j][0]) + abs(a[i][1] - b[j][1])\n        if distance < shortest:\n            idx = j\n            shortest = distance\n    print(idx + 1)", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "N,M=list(map(int,input().split()))\nab=list(list(map(int,input().split())) for _ in range(N))\ncd=list(list(map(int,input().split())) for _ in range(M))\n\nfor i in range(N):\n    k=0\n    d=abs(ab[i][0]-cd[0][0])+abs(ab[i][1]-cd[0][1])\n    for j in range(1,M):\n        if abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])<d:\n            k=j\n            d=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n    print((k+1))\n", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}, {"code": "lst = input().split()\n\nN = int(lst[0])\nM = int(lst[1])\n\nstudents = []\ncheckpoints = []\n\nfor i in range(N):\n   students.append(input().split())\n\nfor i in range(M):\n   checkpoints.append(input().split())\n\ndef distance(P, Q):\n   return abs(int(P[0]) - int(Q[0])) + abs(int(P[1]) - int(Q[1]))\n\nfor s in students:\n   l1 = [10 ** 10]\n   l2 = [0]\n   for i in range(M):\n      if distance(s, checkpoints[i]) < l1[-1]:\n         l1.append(distance(s, checkpoints[i]))\n         l2.append(i+1)\n   print(l2[-1])", "passed": true, "time": 0.15, "memory": 14352.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nNlist, Mlist = [], []\nres = []\n\nfor i in range(N):\n    ab = list(map(int, input().split()))\n    Nlist.append(ab)\n\nfor i in range(M):\n    cd = list(map(int, input().split()))\n    Mlist.append(cd)\n\nfor i in range(N):\n    res = 0\n    mini = float('inf')\n    for j in range(M):\n        calc = abs(Nlist[i][0] - Mlist[j][0]) + abs(Nlist[i][1] - Mlist[j][1])\n        if calc < mini:\n            mini = calc\n            res = j+1\n    print(res) ", "passed": true, "time": 0.15, "memory": 14304.0, "status": "done"}, {"code": "N,M = [int(c) for c in input().split()]\nab = [list(map(int,input().split())) for c in range(N)]\ncd = [list(map(int,input().split())) for c in range(M)]\nfor i in range(N):\n    mi = 10**9\n    for j in range(M):\n        tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n        if mi > tmp:\n            mi = tmp\n            ans = j+1\n    print(ans)\n", "passed": true, "time": 0.16, "memory": 14088.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nstudents = [list(map(int, input().split())) for _ in range(n)]\npoints = [list(map(int, input().split())) for _ in range(m)]\nans = []\nfor i in range(n):\n    min_diff = 20 ** 8 + 1\n    near_point = 0\n    for j in range(m):\n        diff = abs(students[i][0] - points[j][0]) + abs(students[i][1] - points[j][1])\n        if diff < min_diff:\n            min_diff = diff\n            near_point = j + 1\n    ans.append(near_point)\nprint(\"\\n\".join(map(str, ans)))", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nX = []\nfor i in range(N):\n  a,b = map(int,input().split())\n  X.append((a,b))\nC = []\nfor i in range(M):\n  c,d = map(int,input().split())\n  C.append((c,d))\nans = [0 for _ in range(N)]\nINF = float(\"inf\")\nfor i in range(N):\n  MIN = INF\n  check = -1\n  for y in range(M):\n    temp = abs(X[i][0]-C[y][0]) + abs(X[i][1]-C[y][1])\n    if temp < MIN:\n      MIN = temp\n      check = y+1\n  ans[i] = check\nprint(*ans,sep=\"\\n\")", "passed": true, "time": 0.15, "memory": 14284.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nab=[list(map(int,input().split())) for _ in range(n)]\ncd=[list(map(int,input().split())) for _ in range(m)]\nr=[]\nfor i in ab:\n  x1,y1=i[0],i[1]\n  temp=[]\n  for j in cd:\n    x2,y2=j[0],j[1]\n    temp.append(abs(x1-x2)+abs(y1-y2))\n  r.append(temp.index(min(temp))+1)\nprint(*r,sep='\\n')", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "N,M=map(int,input().split())\na=[0]*N;b=[0]*N;\nc=[0]*M;d=[0]*M;\nfor i in range(N) :\n  a[i],b[i]=map(int,input().split())\nfor i in range(M) :\n  c[i],d[i]=map(int,input().split())\n\nfor i in range(N) :\n  min=0\n  for j in range(M) :\n    if abs(a[i]-c[min])+abs(b[i]-d[min]) > abs(a[i]-c[j])+abs(b[i]-d[j]) :\n      min=j\n  print(min+1)", "passed": true, "time": 0.23, "memory": 14132.0, "status": "done"}, {"code": "# B - Checkpoints\ndef main():\n    n, m = map(int, input().split())\n    a_b = [input().split() for i in range(n)]\n    c_d = [input().split() for i in range(m)]\n\n    for i in range(n):\n        temp = []\n        for j in range(m):\n            temp.append(abs(int(a_b[i][0])-int(c_d[j][0]))+abs(int(a_b[i][1])-int(c_d[j][1])))\n        else:\n            print(temp.index(min(temp))+1)\n\n\n        \ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "n,m = map(int, input().split(\" \"))\na = [list(map(int, input().split(\" \"))) for i in range(n)]\nb = [list(map(int, input().split(\" \"))) for i in range(m)]\n\nfor ax, ay in a:\n  c = []\n  for bx, by in b:\n    c.append(abs(bx-ax)+abs(by-ay))\n  print(c.index(min(c)) + 1)", "passed": true, "time": 0.33, "memory": 14168.0, "status": "done"}, {"code": "n,m=list(map(int,input().split()))\nab=[list(map(int,input().split())) for i in range(n)]\ncd=[list(map(int,input().split())) for j in range(m)]\nfor i in range(n):\n  dis=float('inf')\n  ch=0\n  for j in range(m):\n    if dis>abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]):\n      dis=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n      ch=j\n  print((ch+1))\n", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "n,m = map(int, input().split())\nst = []\npt = []\nch = []\nfor i in range(n):\n  st.append(list(map(int, input().split())))\nfor i in range(m):\n  pt.append(list(map(int, input().split())))\nfor j in st:\n  for k in pt:\n    d = abs(j[0]-k[0]) + abs(j[1]-k[1])\n    ch.append(d)\n  print(ch.index(min(ch))+1)\n  ch = []", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nStd = [tuple(map(int, input().split())) for _ in range(N)]\nChp = [tuple(map(int, input().split())) for _ in range(M)]\nINF = 10e9\nArrv = []\nMdist = lambda x,y,u,v:abs(x-u)+abs(y-v)\nfor s in Std:\n    close = INF\n    for i in range(M):\n        dist = Mdist(*s,*Chp[i])\n        if dist < close:\n            close = dist\n            arrv = i+1\n    Arrv.append(arrv)\nfor ar in Arrv:\n    print(ar)    ", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nab = [tuple(map(int, input().split())) for _ in range(n)]\ncd = [tuple(map(int, input().split())) for _ in range(m)]\n\nfor i in range(n):\n    x = 1 << 30\n    y = -1\n    a, b = ab[i]\n    for j in range(m):\n        c, d = cd[j]\n        d = abs(a - c) + abs(b - d)\n        if x > d:\n            x = d\n            y = j\n    print((y + 1))\n", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nA=[]\nB=[]\nC=[]\nD=[]\nE=[]\nans=0\nfor i in range(n):\n    a,b=map(int,input().split())\n    A.append(a)\n    B.append(b)\nfor i in range(m):\n    c,d=map(int,input().split())\n    C.append(c)\n    D.append(d)\nfor i in range(n):\n    for j in range(m):\n        ans = abs(A[i]-C[j])+abs(B[i]-D[j])\n        E.append(ans)\n        ans=0\n    print(E.index(min(E))+1)\n    E.clear()", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nab,cd=[list(map(int,input().split())) for _ in range(n)],[list(map(int,input().split())) for _ in range(m)]\nfor i in ab:\n  r=[]\n  for j in cd: r.append(abs(i[0]-j[0])+abs(i[1]-j[1]))\n  print(r.index(min(r))+1)", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nstu = [0]*N\nfor i in range(N):\n    stu[i] = list(map(int,input().split()))\n\ncp = [0]*M\nfor i in range(M):\n    cp[i] = list(map(int,input().split()))\n\n# print(stu,cp)\nstumo = [0]*N\nfor i in range(N):\n    min_move = 10000000000000000000000000\n    for j in range(M):\n        min_his = min_move \n        mhd = abs(stu[i][0]-cp[j][0]) + abs(stu[i][1]-cp[j][1])\n        min_move = min(min_move,mhd)\n        if(min_move != min_his):\n            stumo[i] = j+1\n# print(stumo)\nfor i in range(N):\n    print(stumo[i])", "passed": true, "time": 0.14, "memory": 14444.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nab = [list(map(int,input().split())) for _ in range(N)]\ncd = [list(map(int,input().split())) for _ in range(M)]\n\nfor i in range(N):\n  dist = float(\"inf\")\n  ans = 0\n  a,b = ab[i][0],ab[i][1]\n  \n  for j in range(M)[::-1]:\n    c,d = cd[j][0],cd[j][1]\n    if abs(a-c) + abs(b-d) <= dist:\n      dist = abs(a-c) + abs(b-d)\n      ans = j + 1\n  \n  print(ans)", "passed": true, "time": 0.14, "memory": 14288.0, "status": "done"}, {"code": "import sys\n\nn,m = list(map(int,input().split()))\na = [list(map(int,input().split())) for i in range(n)]\nb = [list(map(int,input().split())) for i in range(m)]\nchkPoint = [0]*n\n\nfor i,axy in enumerate(a):\n    ax,ay = axy\n    dist = sys.maxsize\n    for j,bxy in enumerate(b):\n        bx,by = bxy\n        if dist > abs(ax-bx)+abs(ay-by):\n            chkPoint[i] = j+1\n            dist = abs(ax-bx)+abs(ay-by)\n    print((chkPoint[i]))\n", "passed": true, "time": 0.15, "memory": 14328.0, "status": "done"}, {"code": "from sys import stdin\nnii=lambda:map(int,stdin.readline().split())\nlnii=lambda:list(map(int,stdin.readline().split()))\n\nn,m=nii()\nab=[lnii() for i in range(n)]\ncd=[lnii() for i in range(m)]\n\nans=[]\nfor a,b in ab:\n  min_dist=10**10\n  for i in range(m):\n    c,d=cd[i]\n    if abs(a-c)+abs(b-d)<min_dist:\n      t_ans=i\n      min_dist=abs(a-c)+abs(b-d)\n  ans.append(t_ans+1)\n\nfor i in ans:\n  print(i)", "passed": true, "time": 0.14, "memory": 14392.0, "status": "done"}, {"code": "N,M=list(map(int,input().split()))\nA=[]\nB=[]\nC=[]\nD=[]\nfor i in range(N):\n\tx,y=list(map(int,input().split()))\n\tA.append(x)\n\tB.append(y)\nfor i in range(M):\n\tx,y=list(map(int,input().split()))\n\tC.append(x)\n\tD.append(y)\nfor i in range(N):\n\tans=[]\n\tfor j in range(M):\n\t\ttmp=abs(A[i]-C[j])+abs(B[i]-D[j])\n\t\tans.append(tmp)\n\tT=len(ans)\n\tfor k in range(T):\n\t\tif ans[k]==min(ans):\n\t\t\tprint((k+1))\n\t\t\tbreak\n", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nS = [tuple(map(int, input().split())) for _ in range(N)]\nC = [tuple(map(int, input().split())) for _ in range(M)]\nfor i in S:\n  ans = 0\n  k = 10 ** 10\n  for j in range(M):\n    n = abs(i[0] - C[j][0]) + abs(i[1] - C[j][1])\n    if k > n:\n      k = n\n      ans = j + 1\n  else:\n    print(ans)", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "n, m = list(map(int,input().split()))\ns_x_plus_y = []\ns_x_minus_y = []\np_x_plus_y = []\np_x_minus_y = []\n\nfor student in range(n):\n    x, y = list(map(int,input().split()))\n    s_x_plus_y.append(x + y)\n    s_x_minus_y.append(x - y)\n\nfor i in range(m):\n    x, y = list(map(int,input().split()))\n    p_x_plus_y.append(x + y)\n    p_x_minus_y.append(x - y)\n\n\nfor i in range(n):\n    p_dist = []\n    for j in range(m):\n        p1 = abs(s_x_plus_y[i] - p_x_plus_y[j])\n        p2 = abs(s_x_minus_y[i] - p_x_minus_y[j])\n        d = max(p1, p2)\n        p_dist.append(d)\n    print((p_dist.index(min(p_dist))+1))\n", "passed": true, "time": 0.14, "memory": 14184.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nab=[list(map(int, input().split())) for i in range(n)]\ncd=[list(map(int, input().split())) for j in range(m)]\n\nfor i in range(n):\n    l=[]\n    for j in range(m):\n        dist=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n        l.append(dist)\n    goal = l.index(min(l))+1\n    print(goal)", "passed": true, "time": 0.14, "memory": 14152.0, "status": "done"}, {"code": "def dis(a, b, c, d):\n    num = abs(a - c) + abs(b - d)\n    return num\n\nn,m = list(map(int,input().split()))\na = [0] * n\nb = [0] * n\nc = [0] * m\nd = [0] * m\n\nfor i in range(n):\n    a[i], b[i] = list(map(int,input().split()))\nfor i in range(m):\n    c[i], d[i] = list(map(int, input().split()))\n\nfor i in range(n):\n    ans = []\n    for j in range(m):\n        ans.append(dis(a[i],b[i],c[j],d[j]))\n    print((ans.index(min(ans)) + 1))\n\n", "passed": true, "time": 0.15, "memory": 14200.0, "status": "done"}, {"code": "def dist(x, y):\n    return abs(x[0] - y[0]) + abs(x[1] - y[1])\n\n\nN, M = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(N)]\nCD = [list(map(int, input().split())) for _ in range(M)]\nfor i in range(N):\n    ans = -1\n    min_dist = float(\"inf\")\n    for j in range(M):\n        if (d := dist(AB[i], CD[j])) < min_dist:\n            ans = j\n            min_dist = d\n    print((ans + 1))\n", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "import sys, math\nfrom itertools import combinations as c, product as p\nfrom collections import deque\nsys.setrecursionlimit(10**9)\nINF = float('inf')\nMOD = 10**9 + 7\n#MOD = 998244353\n\n\ndef si(): return input()\ndef ii(): return int(input())\ndef fi(): return float(input())\ndef lstr(): return input().split()\ndef lint(): return list(map(int, input().split()))\ndef lintdec(): return list(map(lambda x:int(x) - 1, input().split()))\ndef lnstr(n): return [input() for _ in range(n)]\ndef lnint(n): return [int(input()) for _ in range(n)]\ndef lint_list(n): return [lint() for _ in range(n)]\n\n\n\n############################################################\nN, M = lint()\nstudents = lint_list(N)\ncheck = lint_list(M)\n\nfor sx, sy in students:\n    ans = -1\n    dist = INF\n    for i in range(M):\n        cx, cy = check[i]\n        tmp = abs(cx - sx) + abs(cy - sy)\n        if tmp < dist:\n            dist = tmp\n            ans = i + 1\n    print(ans)", "passed": true, "time": 0.14, "memory": 14332.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nab = [list(map(int, input().split())) for _ in range(n)]\ncd = [list(map(int, input().split())) for _ in range(m)]\nfor i in range(n):\n    num = 0\n    ans = float('inf')\n    for j in range(m):\n        man = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1] - cd[j][1])\n        if man < ans :\n            ans = man\n            num = j\n    print(num+1)", "passed": true, "time": 0.15, "memory": 14420.0, "status": "done"}, {"code": "n,m =map(int,input().split())\na=[0]*n\nb=[0]*n\nc=[0]*m\nd=[0]*m\nfor i in range(n):\n    a[i],b[i]=map(int,input().split())\nfor i in range(m):\n    c[i],d[i]=map(int,input().split())\n\nfor i in range(n):\n    for j in range(m):\n        if j==0:\n            ind=0\n            dis=abs(a[i]-c[j])+abs(b[i]-d[j])\n        else:\n            if abs(a[i]-c[j])+abs(b[i]-d[j])<dis:\n                ind=j\n                dis = abs(a[i] - c[j]) + abs(b[i] - d[j])\n    print(ind+1)", "passed": true, "time": 0.14, "memory": 14152.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nab = []\nfor i in range(n):\n    ab.append(list(map(int, input().split())))\n\ncd = []\nfor i in range(m):\n    cd.append(list(map(int, input().split())))\n\nfor i in range(n):\n    a, b = ab[i]\n    dis = 10 ** 9\n    point = 0\n    for j in range(m):\n        c, d = cd[j]\n        if abs(a - c) + abs(b - d) < dis:\n            point = j + 1\n            dis = abs(a - c) + abs(b - d)\n    print(point)\n", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}]