CodeEff/ECCO huggingface dataset:
# Original solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
4
1 2 3 5

output:
30
"""

import sys
from functools import reduce


def gcd(x, y):
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    return x


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(_n_list):
    return reduce(lcm, _n_list)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    cnt = int(_input[0])
    n_list = list(map(int, _input[1].split()))
    print((solve(n_list)))

# Optimized solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
4
1 2 3 5

output:
30
"""

import sys
from functools import reduce


def gcd(x, y):
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    return x


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(_n_list):
    return reduce(lcm, _n_list)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    cnt = int(_input[0])
    n_list = tuple(map(int, _input[1].split()))
    print((solve(n_list)))
# Original solution
eval(input())
a=list(map(int,input().split()))
m=max(a)
i,f=1,0
while i:
    for j in a:
        if (m*i)%j:break
        if j==a[-1]: f=1
    if f:break
    i+=1
print((m*i))

# Optimized solution
def gcd(a,b):
    while b:a,b=b,a%b
    return a

def lcm(a,b):
    return a//gcd(a,b)*b

eval(input())
a=list(map(int,input().split()))
b=1
for i in a:
    b=lcm(b,i)
print(b)
# Original solution
import sys
 
n = int(sys.stdin.readline())
s = sys.stdin.readline()

def count(s, idx):
	w = s.count("W", 0, idx)
	e = s.count("E", idx + 1)

	return w + e

m = count(s, 0)
j = 0

for i in range(1, len(s)): 
	m2 = count(s, i)
	if m2 < m:
		m = m2
		j = i

print(m)


# Optimized solution
import sys
 
n = int(sys.stdin.readline())
s = list(sys.stdin.readline())

it = s[0]
w = 0
e = s[1:].count('E')

m = e
j = 0

for i in range(1, len(s)):
	if it == 'W':
		w = w + 1

	it = s[i]

	if it == 'E':
		e = e - 1

	m2 = w + e
	if m2 < m:
		m = m2
		j = i
print(m)
# Original solution
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, S):
    ans = sys.maxsize
    for i in range(N):
        ans = min(ans, S[:i].count('W') + S[i + 1:].count('E'))
    return ans


def main():
    N = read_int()
    S = read_str()
    print(slv(N, S))


if __name__ == '__main__':
    main()


# Optimized solution
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, S):

    W = 0
    E = S.count('E')
    ans = E + W
    for s in S:
        if s == 'E':
            E -= 1

        ans = min(E + W, ans)

        if s == 'W':
            W += 1

    return ans


def main():
    N = read_int()
    S = read_str()
    print(slv(N, S))


if __name__ == '__main__':
    main()
# Original solution
_, s = open(0).read().split()
left, right = [0], []
lw, re = 0, 0
for i in s:
  if i == 'W':
    lw += 1
  left += [lw]
for i in s[::-1]:
  if i == 'E':
    re += 1
  right += [re]
print((min(i + j for i, j in zip(left[:-1], right[-2::-1] + [0]))))

# Optimized solution
def main():
  _, s = open(0).read().split()
  w, res = 0, 0
  for i in s:
    if i == 'W':
      w += 1
    elif w:
      w -= 1
      res += 1
    else:
      pass
  return res


if __name__ == '__main__':
  print((main()))
# Original solution
N,M=list(map(int,input().split()))
n=[list(map(int,input().split())) for _ in range(N)]
m=[list(map(int,input().split())) for _ in range(M)]
result=[]
for i in range(len(n)):
  result=[]
  for j in range(len(m)):
    result.append(abs(n[i][0]-m[j][0])+abs(n[i][1]-m[j][1]))
  print((result.index(min(result))+1))

# Optimized solution
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')
# Original solution
n,m=list(map(int,input().split()))
a=[]
b=[]
c=[]
d=[]
for i in range(n):
  A,B=list(map(int,input().split()))
  a.append(A)
  b.append(B)
for i in range(m):
  C,D=list(map(int,input().split()))
  c.append(C)
  d.append(D)
for i in range(n):
  minimum=1000000000
  ans=0
  for j in range(m):
    if abs(a[i]-c[j])+abs(b[i]-d[j])<minimum:
      minimum=abs(a[i]-c[j])+abs(b[i]-d[j])
      ans=j+1
  print(ans)
      

# Optimized solution
n,m=list(map(int,input().split()))
a=[]
b=[]
for i in range(n):
  x,y=list(map(int,input().split()))
  a.append([x,y])
for i in range(m):
  x,y=list(map(int,input().split()))
  b.append([x,y])
for i in a:
  ans=10**18
  t=0
  for j in range(m):
    if abs(i[0]-b[j][0])+abs(i[1]-b[j][1])<ans:
      t=j+1
      ans=abs(i[0]-b[j][0])+abs(i[1]-b[j][1])
  print(t)
# Original solution
def manhattan_distance(s, c):
    return abs(s[0]-c[0]) + abs(s[1]-c[1])


def main():
    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 s in student:
        d = {}
        for i, c in enumerate(checkpoint):
            d[i] = manhattan_distance(s, c)
        print((sorted(list(d.items()), key=lambda x: x[1])[0][0]+1))
    


if __name__ == "__main__":
    main()

# Optimized solution
def man_dis(s, c):
    return abs(s[0]-c[0])+abs(s[1]-c[1])


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

    for s in s_list:
        minv = 1000000000
        for i, c in enumerate(c_list):
            tmp = man_dis(s, c)
            if tmp < minv:
                minv = tmp
                idx = i
        print((idx+1))
    

if __name__ == "__main__":
    main()
# Original solution
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):
  s = 0
  t = float('inf')
  for j in range(m):
    p = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
    if p < t:
      s = j+1
      t = p
  print(s) 

# Optimized solution
n,m = list(map(int, input().split()))
ab = []
for _ in range(n):
  a,b = list(map(int, input().split()))
  ab.append((a,b))
cd = []
for _ in range(m):
  c,d = list(map(int, input().split()))
  cd.append((c,d))
  
for i in ab:
  s = float("inf")
  for j in range(m):
    t = abs(i[0]-cd[j][0]) + abs(i[1]-cd[j][1])
    if t < s:
      s = t
      ans = j+1
  print(ans)
# Original solution
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)]

p = [float("INF")] * n
check = [""]*n
for i in range(n):
    for j in range(m):
        if abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]) < p[i]:
            p[i] = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
            check[i] = j+1
for s in check: print(s)

# Optimized solution
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 a,b in ab:
    ans = []
    for c,d in cd:
        ans.append(abs(a-c)+abs(b-d))
    print((ans.index(min(ans))+1))
# Original solution
n, m = (int(i) for i in input().split())
ab = [[int(i) for i in input().split()] for j in range(n)]
cd = [[int(i) for i in input().split()] for j in range(m)]

for i in range(n):
    d_min = 1000000000
    p_num = 0
    for j in range(m):
        cur_d = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if cur_d < d_min:
            d_min = cur_d
            p_num = j + 1
    print(p_num)

# Optimized solution
def main():
    N, M = (int(i) for i in input().split())
    AB = [[int(i) for i in input().split()] for j in range(N)]
    CD = [[int(i) for i in input().split()] for j in range(M)]

    for a, b in AB:
        cur = 10**12
        cur_ans = -1
        for i, cd in enumerate(CD):
            if cur > abs(a-cd[0])+abs(b-cd[1]):
                cur = abs(a-cd[0])+abs(b-cd[1])
                cur_ans = i
        print((cur_ans+1))


if __name__ == '__main__':
    main()
# Original solution
def main():
    N, M = (int(i) for i in input().split())
    AB = [[int(i) for i in input().split()] for j in range(N)]
    CD = [[int(i) for i in input().split()] for j in range(M)]

    for a, b in AB:
        cur = 10**12
        cur_ans = -1
        for i, cd in enumerate(CD):
            if cur > abs(a-cd[0])+abs(b-cd[1]):
                cur = abs(a-cd[0])+abs(b-cd[1])
                cur_ans = i
        print((cur_ans+1))


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, M = (int(i) for i in input().split())
    AB = [[int(i) for i in input().split()] for j in range(N)]
    CD = [[int(i) for i in input().split()] for j in range(M)]
    for a, b in AB:
        mi = 10**20
        ans = -1
        for i, p in enumerate(CD):
            d = abs(p[0] - a) + abs(p[1] - b)
            if d < mi:
                mi = d
                ans = i+1
        print(ans)


if __name__ == '__main__':
    main()
# Original solution
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)]
ans = [0]*n
for i in range(n):
    count = 10**9
    for j in range(m):
        ch = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        #print("i =",i,"j=",j,"ch =",ch,count)
        if ch < count:
            ans[i] = j+1
            count = ch
    print((ans[i]))

# Optimized solution
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)]
ans = [0]*n
for i in range(n):
    count = 10**9
    for j in range(m):
        ch = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if ch < count:
            ans[i] = j+1
            count = ch
    print((ans[i]))
# Original solution
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):
    a, b = AB[i]
    res = float("inf")
    for j in range(m):
        c, d = CD[j]
        dist = abs(a - c) + abs(b - d)
        if res > dist:
            res = dist
            ans = j + 1
    print(ans)

# Optimized solution
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    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 a, b in AB:
        min_dist = f_inf
        res = 0
        for i in range(m):
            c, d = CD[i]
            dist = abs(a - c) + abs(b - d)
            if min_dist > dist:
                min_dist = dist
                res = i + 1
        print(res)


if __name__ == '__main__':
    resolve()
# Original solution
N, M = list(map(int, input().split()))
ab = [[int(i) for i in input().split()] for i in range(N)]
cd = []
for i in range(M):
    c, d = list(map(int, input().split()))
    cd.append([c, d, i])

ans = []
for a, b in ab:
    dis = float('inf')
    num = 0
    for c, d, i in cd:
        if (abs(c-a) + abs(b-d)) < dis:
            dis = (abs(c-a) + abs(b-d))
            num = i + 1
    ans.append(num)

for i in ans:
    print(i)


# Optimized solution
N, M = list(map(int, input().split()))
ab = [[int(i) for i in input().split()] for i in range(N)]
cd = [[int(i) for i in input().split()] for i in range(M)]
ans = []


for a, b in ab:
    num = float('inf')
    for i in range(M):
        if num > abs(a - cd[i][0]) + abs(b - cd[i][1]):
            num = abs(a - cd[i][0]) + abs(b - cd[i][1])
            check = i + 1
    ans.append(check)

for i in ans:
    print(i)
# Original solution
n,m = list(map(int,input().split()))
x = [list(map(int,input().split())) for i in range(n)]
y = [list(map(int,input().split())) for i in range(m)]
for a,b in x:
  l = [abs(a-c)+abs(b-d) for c,d in y]
  print((l.index(min(l))+1))

# Optimized solution
n,m = list(map(int,input().split()))
x = [list(map(int,input().split())) for i in [0]*(n+m)]
for a,b in x[:n]:
  l = [abs(a-c)+abs(b-d) for c,d in x[n:]]
  print((l.index(min(l))+1))
# Original solution
n,m=list(map(int,input().split()))
a=[[int(j) for j in input().split()] for i in range(n)]
c=[[int(j) for j in input().split()] for i in range(m)]
for i in range(n):
    d=10e8
    b=0
    for j in range(m):
        if abs(a[i][0]-c[j][0])+abs(a[i][1]-c[j][1])<d:
            d=abs(a[i][0]-c[j][0])+abs(a[i][1]-c[j][1])
            b=j+1
    print(b)

# Optimized solution
n,m=list(map(int,input().split()))
ab=[[int(j) for j in input().split()] for i in range(n)]
cd=[[int(j) for j in input().split()] for i in range(m)]
for a,b in ab:
    l=[abs(a-c)+abs(b-d) for c,d in cd]
    print((l.index(min(l))+1))
# Original solution
N,M = list(map(int,input().split()))
students = [list(map(int,input().split()))for i in range(N)]
checkPoints = [list(map(int,input().split()))for i in range(M)]

for i in range(N):
    idx = -1
    mindis = 3*10**8
    sx,sy = students[i]
    for j in range(M):
        cx,cy = checkPoints[j]
        distance = abs(sx-cx)+ abs(sy-cy)
        if mindis > distance:
            idx = j+1
            mindis = distance
    print(idx)



# Optimized solution
N,M = list(map(int,input().split()))
students = [list(map(int,input().split()))for i in range(N)]
checkPoints = [list(map(int,input().split()))for i in range(M)]

for i in range(N):
    idx = 1
    mindis = abs(students[i][0]-checkPoints[0][0])+ abs(students[i][1]-checkPoints[0][1])
    sx,sy = students[i]
    for j in range(1,M):
        cx,cy = checkPoints[j]
        distance = abs(sx-cx)+ abs(sy-cy)
        if mindis > distance:
            idx = j+1
            mindis = distance
    print(idx)
# Original solution
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

n,m=list(map(int,input().split()))
ab=[tuple(map(int,input().split())) for i in range(n)]
cd=[tuple(map(int,input().split())) for i in range(m)]
for a,b in ab:
    tmp=inf
    candi=0
    for j in range(m):
        c=cd[j][0]
        d=cd[j][1]
        k=abs(a-c)+abs(b-d)
        if tmp>k:
            tmp=k
            candi=j
    print((candi+1))




# Optimized solution
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,m = list(map(int,input().split()))
CD = [tuple(map(int,input().split())) for i in range(n)]
AB = [tuple(map(int,input().split())) for i in range(m)]
for c,d in CD:
  print((min(list(range(m)),key = lambda x:abs(AB[x][0]-c) + abs(AB[x][1]-d))+1))
# Original solution
import math

INF = 1001001001

def resolve():
  n, m = list(map(int, input().split()))
  s = []
  c = []

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

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

  for a in s:
    ans = 0
    dist = INF
    for i in range(m):
      if abs(a[0] - c[i][0]) + abs(a[1] - c[i][1]) < dist:
        dist = abs(a[0] - c[i][0]) + abs(a[1] - c[i][1])
        ans = i+1
    print(ans)
  return

if __name__ == "__main__":
  resolve()



# Optimized solution
def resolve():
  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 a in ab:
    ans = 0
    dist = 10000000000
    for i in range(m):
      tmp = abs(a[0] - cd[i][0]) + abs(a[1] - cd[i][1])
      if tmp < dist:
        ans = i+1
        dist = tmp
    print(ans)
  return

if __name__ == "__main__":
  resolve()
# Original solution
N,M = map(int,input().split())
st = [tuple(map(int,input().split())) for i in range(N)]
ch = [tuple(map(int,input().split())) for i in range(M)]

ans = []
for sx,sy in st:
    minci = 1
    mind = float('inf')
    for i,(cx,cy) in enumerate(ch):
        d = abs(sx-cx) + abs(sy-cy)
        if d < mind:
            mind = d
            minci = i+1
    ans.append(str(minci))
print(*ans, sep='\n')


# Optimized solution
N,M = list(map(int,input().split()))
A = [tuple(map(int,input().split())) for i in range(N)]
C = [tuple(map(int,input().split())) for i in range(M)]
for ax,ay in A:
    min_d = 10**10
    min_i = -1
    for i,(cx,cy) in enumerate(C):
        d = abs(ax-cx) + abs(ay-cy)
        if d < min_d:
            min_d = d
            min_i = i
    print((min_i + 1))
# Original solution
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)]
ans = []

for i in range(N):
    index = 0
    lowest = pow(10, 8) * 4
    for j in range(M):
        dist = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if lowest > dist:
            lowest = dist
            index = j
    print((index + 1))


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

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

INF = 10 ** 8 * 4
for s in ss:
    dist = INF
    c_point = 0
    a, b = s
    for i, v in enumerate(p):
        c, d = v
        manhattan = abs(a - c) + abs(b - d)
        if manhattan < dist:
            c_point = i + 1
            dist = manhattan
    print(c_point)
# Original solution
N, M = list(map(int, input().split(" ")))
 
student = [];
pos = [];
for i in range(N) :
	a, b = list(map(int, input().split(" ")))
	student.append((a, b))
 
for i in range(M) :
	a, b = list(map(int, input().split(" ")))
	pos.append((a,b))
 
for st in student :
	ans = -1;
	score = 10**10;
	for i in range(M) :
		tmpscore = abs(st[0] - pos[i][0]) + abs(st[1] - pos[i][1])
		if score > tmpscore :
			score = tmpscore;
			ans = i;
	print((ans+1));

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

student = [  tuple( map(int, input().split()) ) for x in range(N)]
point = [ tuple( map(int, input().split()) ) for x in range(M)]


for (x1, y1) in student :
    data =  [ abs(x1 - x2) + abs(y1 - y2) for (x2, y2) in point ]
    ans = data.index(min(data))
    print((ans + 1))
# Original solution
N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(N)]

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


for a, b in ab:
    ret = -1
    dis = 10**20
    for i, x in enumerate(cd):
        c, d = x
        if dis > abs(c-a) + abs(d-b):
            dis = abs(c-a) + abs(d-b)
            ret = i
    print((ret+1))


# Optimized solution
N, M = map(int, input().split())

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

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

ans = [0]*N

for i, x in enumerate(ab):
    a, b = x
    D = 10**9
    for j, y in enumerate(cd):
        c, d = y
        dis = abs(a-c) + abs(b-d)
        if dis < D:
            D = dis
            ans[i] = j + 1

print(*ans, sep='\n')
# Original solution
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)]#ゴール
l=[0]*n
for i in range(n):
    ans=10**18
    
    for j in range(m):
        a=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        
        if ans>a:
            ans=a
            l[i]=j+1
        if ans==0:
            break
            
print(*l,sep='\n')


# Optimized solution
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 i in range(m)]

for i in range(n):
    x=ab[i][0]
    y=ab[i][1]
    ans = [float('inf')] * 2
    for j in range(m):
        man=abs(x-cd[j][0])+abs(y-cd[j][1])
        if ans[0]>man:
            ans=[man,j+1]

    print((ans[1]))
# Original solution
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)


# Optimized solution
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)
# Original solution
n, m = list(map(int, input().split()))
AB = [[int(i) for i in input().split()] for i in range(n)]
CD = [[int(i) for i in input().split()] for i in range(m)]

for a, b in AB:
    dist = [abs(a - c) + abs(b - d) for c, d in CD]
    print((dist.index(min(dist)) + 1))

# Optimized solution
n, m = list(map(int, input().split()))
AB = [[int(i) for i in input().split()] for i in range(n)]
CD = [[int(i) for i in input().split()] for i in range(m)]

for ab in AB:
    ans = 10 ** 12
    id = 0
    for i, cd in enumerate(CD):
        tmp = abs(ab[0] - cd[0]) + abs(ab[1] - cd[1])
        if tmp < ans:
            ans = tmp
            id = i + 1
    print(id)
# Original solution
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)]

ans = []
for a in A:
    cur = float('inf')
    for i, b in enumerate(B):
        x = abs(a[0] - b[0]) + abs(a[1] - b[1])
        if  x < cur:
            cur = x
            checkpoint = i + 1
    ans.append(checkpoint)
    
for i in range(n):
    print((ans[i]))

# Optimized solution
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 i in range(m)]

for a, b in AB:
    dist = [[abs(a - c) + abs(b - d)] for c, d in CD]
    print((dist.index(min(dist)) + 1))