jiahuimbzuai/CoQuIR huggingface dataset:
//  [ruby]
s = gets.chomp.reverse

dream = "dream".reverse
dreamer = "dreamer".reverse
erase = "erase".reverse
eraser = "eraser".reverse

while not s.empty? do
    
    k = s.size
    next if s.sub!(eraser,  "")
    next if s.sub!(erase,   "")
    next if s.sub!(dreamer, "")
    next if s.sub!(dream,   "")
    
    if k == s.size
        puts "NO"
        exit
    end
end

puts "YES"
//  [ruby]
s = gets.chomp.reverse
a = ["resare","esare","remaerd","maerd"]

a.each do |aa|
  if s.include?(aa)
    while s.include?(aa)
      s.slice!(aa)
      # p s
    end
  end

  if s.empty?
    puts 'YES'
    exit
  end
end
puts 'NO'
//  [swift]
import Foundation
let arr = ["dream", "erase", "eraser", "dreamer"]
var S = readLine()!
while true {
    var flag = true
    for s in arr {
        if S.hasSuffix(s) {
            S = S.substringToIndex(S.endIndex.advancedBy(-s.characters.count))
            flag = false
        }
    }
    if flag {
        break
    }
}
print(S=="" ?"YES":"NO")
//  [swift]
import Foundation
let arr = ["dream", "erase", "eraser", "dreamer"]
var S = readLine()!
var flag = false
repeat {
    flag = false
    for s in arr {
        if S.hasSuffix(s) {
            S = S.substringToIndex(S.endIndex.advancedBy(-s.characters.count))
            flag = true
        }
    }
} while flag
print(S=="" ?"YES":"NO")
//  [swift]
import Foundation
var S = readLine()!
while true {
    if S.hasSuffix("dream") || S.hasSuffix("erase") {
        S = S.substringToIndex(S.endIndex.advancedBy(-5))
    } else if S.hasSuffix("eraser") {
        S = S.substringToIndex(S.endIndex.advancedBy(-6))
    } else if S.hasSuffix("dreamer") {
        S = S.substringToIndex(S.endIndex.advancedBy(-7))
    } else {
        break
    }
}
print(S=="" ?"YES":"NO")
//  [typescript]
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): any => {
  const S = lines[0]
  const obj = { S }
  debug(obj)
  return obj
}

const TERMS = ['dream', 'dreamer', 'erase', 'eraser']

const retrive = (target: string): Boolean => {
  if (target === "") {
    return true
  }
  if (target && target[0] !== "e" && target[0] !== "d") {
    return false
  }
  for (let i = 0; i < TERMS.length; i++) {
    if (target.startsWith(TERMS[i])) {
      const next = target.substr(TERMS[i].length)
      if (retrive(next)) {
        return true
      }
    }
  }
  return false
}

// solver
export const solve = (lines: string[]): string => {
  let { S: target } = parseLines(lines)
  let targets = [target]
  while (targets.length > 0) {
    const next: string[] = []
    for (let t of targets) {
      if (t.length === 0) {
        return 'YES'
      }
      for (let term of TERMS) {
        if (t.startsWith(term)) {
          next.push(t.substr(term.length))
        }
      }
    }
    targets = next
  }
  return 'NO'
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}
//  [typescript]
const main = (input) => {
    const reverse = (s) => {
        return s.split('').reverse().join('');
    };

    const WORDS = ['dream', 'dreamer', 'erase', 'eraser'].map(reverse);
    const S = reverse(input.split('\n')[0]);

    const index = 0;

    while(true) {
        const w = WORDS.find((w) => S.startsWith(w, index));
        if (!w) break;
        index += w.length;
    }

    if (S.length === index) {
        console.log('YES');
    } else {
        console.log('NO');
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
function main(input) {
    const reverse = (s) => {
        return s.split('').reverse().join('');
    };

    const WORDS = ['dream', 'dreamer', 'erase', 'eraser'].map(reverse);
    const S = reverse(input.split('\n')[0]);

    var index = 0;

    while(true) {
        var w = WORDS.find((w) => S.startsWith(w, index));
        if (!w) break;
        index += w.length;
    }

    if (S.length === index) {
        console.log('YES');
    } else {
        console.log('NO');
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
import sys
readline = sys.stdin.readline

def main():
    N, M = map(int, readline().rstrip().split())
    AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]
    CD = [list(map(int, readline().rstrip().split())) for _ in range(M)]
    for a, b in AB:
        dist = 10**10
        ans = -1
        for i, (c, d) in enumerate(CD):
            if abs(a-c) + abs(b-d) < dist:
                dist = abs(a-c) + abs(b-d)
                ans = i + 1
        print(ans)


if __name__ == '__main__':
    main()
//  [python]
N, M = 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)
//  [python]
N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
C = [list(map(int, input().split())) for _ in range(M)]


for a in A:
    distance = 10**9
    point = 0
    for i, c in enumerate(C):
        if abs(a[0] - c[0]) + abs(a[1] - c[1]) < distance:
            distance = abs(a[0] - c[0]) + abs(a[1] - c[1])
            point = i
    print(point + 1)
//  [python]
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n,m = LI()
    a = [LI() for _ in range(n)]
    b = [LI() for _ in range(m)]
    r = []
    for ai in a:
        mi = -1
        mm = inf
        for i in range(m):
            bi = b[i]
            t = abs(ai[0]-bi[0]) + abs(ai[1]-bi[1])
            if t < mm:
                mi = i+1
                mm = t
        r.append(mi)

    return '\n'.join(map(str, r))



print(main())
//  [python]
import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
ab = np.array([LI() for _ in range(N)])
cd = np.array([LI() for _ in range(M)])
for x in ab:
    print(abs(cd-x).sum(axis=1).argmin()+1)
//  [python]
import numpy as np
n, m = map(int,input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l1 = [list(map(int,input().split())) for _ in range(m)]
#print(l)
#print(l1)
for i in l:
  l2 = []
  #print(i)
  for j in l1:
    #print(j)
    a = abs(i[0]-j[0]) + abs(i[1]-j[1])
    l2.append(a)
  print(np.argmin(l2)+1)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

	static final int X = 0;
	static final int Y = 1;
	
	public static void main(String[] args) throws IOException 
	{
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int N = Integer.parseInt(str.substring(0, str.indexOf(" ")));
		int M = Integer.parseInt(str.substring(str.indexOf(" ") + 1));
		int Students[][] = new int[N][2];
		int CheckPoints[][] = new int[M][2];
		int Lan[][] = new int[N][2];
		for(int i = 0; i < N; i++)
		{
			str = br.readLine();
			Students[i][X] = Integer.parseInt(str.substring(0, str.indexOf(" ")));
			Students[i][Y] = Integer.parseInt(str.substring(str.indexOf(" ") + 1));
			Lan[i][0] = 1000000000;
			Lan[i][1] = 0;
		}
		for(int i = 0; i < M; i++)
		{
			str = br.readLine();
			CheckPoints[i][X] = Integer.parseInt(str.substring(0, str.indexOf(" ")));
			CheckPoints[i][Y] = Integer.parseInt(str.substring(str.indexOf(" ") + 1));
		}
		for(int i = 0; i < N; i++)
		{
			for(int j = 0; j < M; j++)
			{
				if(Lan[i][0] > Math.abs(Students[i][X] - CheckPoints[j][X]) + Math.abs(Students[i][Y] - CheckPoints[j][Y]))
				{
					Lan[i][0] = Math.abs(Students[i][X] - CheckPoints[j][X]) + Math.abs(Students[i][Y] - CheckPoints[j][Y]);
					Lan[i][1] = j + 1;
				}
			}
		}
		for(int i = 0; i < N; i++)
		{
			System.out.println(Lan[i][1]);
		}
	}

}
//  [java]
import java.awt.Point;
import java.util.*;
public class Main {
	static Scanner s = new Scanner(System.in);
	public static void main(String __[]){
		int n=s.nextInt(),m=s.nextInt();
		Point students[] = new Point[n];
		for(int i=0;i<n;i++)
			students[i]=new Point(s.nextInt(), s.nextInt());
		CheckPoint[] checkPoints = new CheckPoint[m];
		for(int i=0;i<m;i++)
			checkPoints[i]=new CheckPoint(i+1, s.nextInt(), s.nextInt());

		for(Point st:students) {
			System.out.println(
					Arrays.stream(checkPoints)
					.min(((a,b)->
					  Math.abs(st.x-a.p.x)+Math.abs(st.y-a.p.y)
					-(Math.abs(st.x-b.p.x)+Math.abs(st.y-b.p.y)))).get().id
					);
		}
	}
}
class CheckPoint{
	Point p;
	int id;
	CheckPoint(int id,int x,int y) {
		p=new Point(x, y);
		this.id=id;
	}
}
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		long[] a = new long[n];
		long[] b = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
			b[i] = sc.nextLong();
		}
		
		long[] minDist = new long[n];
		int[] asm = new int[n];
		Arrays.fill(minDist, 1000000000);
		for (int i = 1; i <= m; i++) {
			long c = sc.nextLong();
			long d = sc.nextLong();
			for (int j = 0; j < n; j++) {
				long dist = Math.abs(a[j] - c) + Math.abs(b[j] - d);
				if (dist < minDist[j]) {
					minDist[j] = dist;
					asm[j] = i;
				}
			}
		}
		
		Arrays.stream(asm).forEach(System.out::println);
	}
}
//  [java]
import java.util.*;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();

        ArrayList<ArrayList<Integer>> students = parse(N,sc);
        ArrayList<ArrayList<Integer>> checkpoints =  parse(M,sc);
        ArrayList<ArrayList<Integer>> result = new ArrayList<>();
        for(ArrayList<Integer> student : students){
           // result.add();
                    search(student, checkpoints);

        }
       // debugPrint(result);
    }

    private static int distance(ArrayList<Integer> a ,ArrayList<Integer> b ){
        int a_ = Math.abs(a.get(0) -  b.get(0) ) ;
        int b_ = Math.abs(a.get(1) -  b.get(1) );
        return a_ + b_ ;
    }

    private static ArrayList<Integer>  search(ArrayList<Integer> student,ArrayList<ArrayList<Integer>> checkpoints ){
        ArrayList<Integer> distances  =  new ArrayList<Integer>();

        for (ArrayList<Integer> checkpoint : checkpoints){
            distances.add(distance(checkpoint, student));
        }

        Integer minDistance = Collections.min(distances);

        int index = 0;
        for(int i=0  ; i < distances.size();i++ ){
            if(minDistance  == distances.get(i)){
                index = i;
                break;
            }
        }

        System.out.print( index +1);

        System.out.print('\n' );


        return checkpoints.get(index);
    }

    private static ArrayList<ArrayList<Integer>> parse(int rowNum,Scanner sc){
        ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
        IntStream.range(0,rowNum).forEach( n -> {
            int x = sc.nextInt();
            int y = sc.nextInt();
            ArrayList<Integer>  row = new ArrayList<Integer>();
            row.add(x);
            row.add(y);
            result.add(row);
        });
        return result;
    }

    private static void debugPrint( ArrayList<ArrayList<Integer>> data ){
        for(ArrayList<Integer> row : data){
            for(Integer cell : row){
                System.out.print(cell);
                System.out.print(' ');
            }
            System.out.print('\n');
        }
    }
}
//  [cpp]
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define FOR(i,s,e) for (int i=s;i<e;i++)
#define FOE(i,s,e) for (int i=s;i<=e;i++)
#define FOD(i,s,e) for (int i=s;i>=e;i--)
#define SET(a,e) memset(a,e,sizeof(a))
#define LL long long
#define LD long double
#define pb push_back
#define x first
#define y second
#define PII pair<int,int>
#define PLI pair<LL,int>
#define PIL pair<int,LL>
#define PLL pair<LL,LL>
#define eps 1e-9
 
int n,m,i,j,x,xi,a[55][2],b[55][2];
 
int main () {
 
	scanf("%d %d",&n,&m);
	FOE(i,1,n){
	  scanf("%d %d",&a[i][0],&a[i][1]);	
	}
	FOE(i,1,m){
	  scanf("%d %d",&b[i][0],&b[i][1]);		
	}
	FOE(i,1,n){
		x=1000000000;
		xi=1;
		FOE(j,1,m){	
	      if (abs(b[j][0]-a[i][0])+abs(b[j][1]-a[i][1])<x) {
	      	x=abs(b[j][0]-a[i][0])+abs(b[j][1]-a[i][1]);
	      	xi=j;
	      }
	      }
	    printf("%d\n",xi);
		}
	return 0;	
}
//  [cpp]
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=51;
const int INF =(1<<30);
struct Node {
	int x,y;
}s[maxn],c[maxn];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d%d",&s[i].x,&s[i].y);
	for(int i=1;i<=m;i++) scanf("%d%d",&c[i].x,&c[i].y);
	for(int i=1;i<=n;i++) {
		int minn=INF,ans=1;
		for(int j=1;j<=m;j++) {
			if(abs(s[i].x-c[j].x)+abs(s[i].y-c[j].y)<minn)
				minn=abs(s[i].x-c[j].x)+abs(s[i].y-c[j].y),ans=j;
		}
		printf("%d\n",ans);
	}
	return 0;
}
//  [cpp]
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

typedef struct Point{
	long x,y;
} point;

long m_dist(point a,point b){
	return labs(a.x-b.x)+labs(a.y-b.y);
}

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	point student[n];
	point cp[m];
	int i,j,nearest_cp;
	long distance;
	for(i=0;i<n;i++){
		scanf("%ld%ld",&(student[i].x),&(student[i].y));
	}
	for(i=0;i<m;i++){
		scanf("%ld%ld",&(cp[i].x),&(cp[i].y));
	}
	
	for(i=0;i<n;i++){
		nearest_cp=100;
		distance=LONG_MAX;
		for(j=0;j<m;j++){
			if(m_dist(student[i],cp[j])<distance){
				distance=m_dist(student[i],cp[j]);
				nearest_cp=j+1;
			}
			//printf("%ld %ld\n",m_dist(student[i],cp[j]),distance);
		}
		printf("%d\n",nearest_cp);
	}
	
    return 0;
}
//  [cpp]
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<set>
using namespace std;
int main()
{
    int n,m,i,j;
    cin>>n>>m;
    long long a[n],b[n],c[m],d[m],r[n],l,l1;
    for(i=0;i<n;i++)
       cin>>a[i]>>b[i];
    for(i=0;i<m;i++)
       cin>>c[i]>>d[i];
    for(i=0;i<n;i++)
       {
           l=abs(a[i]-c[0])+abs(b[i]-d[0]);
           r[i]=1;
           for(j=1;j<m;j++)
              {
                  l1=abs(a[i]-c[j])+abs(b[i]-d[j]);
                  if(l>l1)
                    {
                        l=l1;
                        r[i]=j+1;
                    }
              }
       }
    for(i=0;i<n;i++)
       cout<<r[i]<<'\n';
    return 0;
}
//  [cpp]
/**
* @author Ashini Singha
* IIT,Jahangirnagar University
*/
#include<bits/stdc++.h>
using namespace std;
#define     ll          long long int
#define     fo(i,b,n)   for(int i=(b); i<(n) ; i++)
#define     xx          first
#define     yy          second
#define     pb          push_back
#define     sz(n)       int(n.size())
#define     pii         pair
#define     MP          make_pair
#define     PI          acos(-1.0)

#define read(x)         scanf("%d",&x)
#define read2(x,y)      scanf("%d%d",&x,&y)
#define readl(x)        scanf("%lld",&x)
#define readl2(x,y)     scanf("%lld%lld",&x,&y)
#define readd(x)        scanf("%lf",&x)
#define readd2(x,y)     scanf("%lf%lf",&x,&y)

#define pr(n)           printf("%d",n)
#define prn(n)          printf("%d\n",n)
#define prl(n)          printf("%lld",n)
#define prln(n)         printf("%lld\n",n)
#define prd(x)          printf("%lf",x)
#define prdn(x)         printf("%lf\n",x)
#define TC(n) printf("Case %d: ",n)
/*_____________E_N_D______________*/

const int N=100;
int ax[N],ay[N];
int bx[N],by[N];


int main()
{

      int n,m;
      cin>>n>>m;

      fo(i,0,n){
            cin>>ax[i]>>ay[i];
      }

      fo(i,0,m){
            cin>>bx[i]>>by[i];
      }
      vector<int>v;
      fo(idx,0,n){
            int val=1;
            ll sum=999999999999;

            fo(i,0,m){
                  ll temp= abs(ax[idx]-bx[i])+abs(ay[idx]-by[i]);
                  if(temp<sum){
                        val=i+1;
                        sum=temp;
                  }
            }
            v.pb(val);
      }
      fo(i,0,sz(v)){
            cout<<v[i]<<endl;
      }



      return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>

int main()
{
	int i, j, n, m;
	int kyori;
	int ans;
	int cp;
	int a[50] = {0};
	int b[50] = {0};
	int c[50] = {0};
	int d[50] = {0};
	
	
	scanf("%d %d", &n, &m);
	
	for(i = 0; i < n; i++) {
		scanf("%d %d", &a[i], &b[i]);
	}
	
	for(i = 0; i < m; i++) {
		scanf("%d %d", &c[i], &d[i]);
	}
	
	for(i = 0; i < n; i++) {
	    for(j = 0; j < m; j++) {
	        kyori = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			
	        if(j == 0) {
	            ans = kyori;
				cp = 0;
	        }else if(ans > kyori) {
	            ans = kyori;
	            cp = j;
	        }
	    }
	    cp++;
	    printf("%d\n", cp);
	}
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  int n,  m;
  scanf("%i %i", &n, &m);
  
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    scanf("%i %i", &a[i], &b[i]);
  }
  
  int c[m], d[m];
  for (int i = 0; i < m; i++) {
    scanf("%i %i", &c[i], &d[i]);
  }
  
  for (int i = 0; i < n; i++) {
    int best = 1 << 30, idx = -1;
    for (int j = 0; j < m; j++) {
      int dist = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (dist < best) {
        best = dist;
        idx = j;
      }
    }
    
    printf("%i\n", idx + 1);
  }
  
  return 0;
}
//  [c]
#include <stdio.h>
#define abs(a) ((a)<0 ? -(a) : (a))
int main(){
  int n, m;  scanf("%d%d", &n, &m);
  int student[55][2], check[55][2];
  int ans[55][2];
  for(int i=0; i<n; i++){
    scanf("%d%d", &student[i][0], &student[i][1]);
    ans[i][0] = 400000003;
  }
  for(int j=0; j<m; j++){
    scanf("%d%d", &check[j][0], &check[j][1]);
    for(int i=0; i<n; i++){
      if(abs(student[i][0]-check[j][0])+abs(student[i][1]-check[j][1])<ans[i][0]){
	ans[i][0] = abs(student[i][0]-check[j][0])+abs(student[i][1]-check[j][1]);
	ans[i][1] = j+1;
      }
    }
  }
  for(int i=0; i<n; i++)
    printf("%d\n", ans[i][1]);
  return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(void){
    int n, m, a[50], b[50], c[50], d[50];
    scanf("%d%d", &n, &m);
    for(int i=0; i<n; i++) scanf("%d%d", &a[i], &b[i]);
    for(int i=0; i<m; i++) scanf("%d%d", &c[i], &d[i]);

    for(int i=0; i<n; i++){
        int check=0;
        float ans = INFINITY;
        for(int j=0; j<m; j++){
            int judge = abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(ans>judge){
                ans = judge;
                check = j+1;
            }
        }
        printf("%d\n", check);
    }
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int n, m;
    int a[50+5], b[50+5];
    int c[50+5], d[50+5];
    scanf("%d %d", &n, &m);
    for(int i=0; i<n; i++)scanf("%d %d", &a[i], &b[i]);
    for(int i=0; i<m; i++)scanf("%d %d", &c[i], &d[i]);
    
    for(int i=0; i<n; i++){
        int min=abs(a[i]-c[0])+abs(b[i]-d[0]);
        int checkpoint=0;
        for(int j=1; j<m; j++){
            int dist=abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(min>dist){
                min=dist;
                checkpoint=j;
            }
        }
        printf("%d\n", checkpoint+1);
    }
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int n, m;
    int a[50+5], b[50+5];
    int c[50+5], d[50+5];
    scanf("%d %d", &n, &m);
    for(int i=0; i<n; i++)scanf("%d %d", &a[i], &b[i]);
    for(int i=0; i<m; i++)scanf("%d %d", &c[i], &d[i]);
    
    for(int i=0; i<n; i++){
        int min=200000001;
        int mini;
        for(int j=0; j<m; j++){
            int l=abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(min>l){
                min=l;
                mini=j;
            }
        }
        printf("%d\n", mini+1);
    }
    return 0;
}
//  [javascript]
'use strict'

const main = arg => {
    arg = arg.trim().split("\n")
    const N = ~~(arg[0].split(" ")[0]);
    const M = ~~(arg[0].split(" ")[1]);
    let arr = arg.slice(1, N + 1);
    let points = arg.slice(N + 1, M + N + 1);

    const parse = v => {
        let temp = v.split(" ").map(vv => parseInt(vv))
        return {
            x: temp[0],
            y: temp[1]
        }
    }
    
    arr = arr.map(parse);
    points = points.map(parse);


    let indexArr = [];
    arr.forEach((v, i) => {
        let minDist = 1000000000;
        let index = 0;
        
        points.forEach((w, j) => {
            let dist = Math.abs(v.x - w.x) + Math.abs(v.y - w.y);
            if(dist < minDist){
                minDist = dist;
                index = j;
            }
        })
        
        indexArr.push(index);
    })

    indexArr.forEach(v => console.log(v + 1));
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))
//  [javascript]
inp = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')
l = inp.shift().split(' ')
N = l[0] * 1
M = l[1] * 1 
s = []
c = []
for (i=0; i<N; i++) {
  s[i] = inp[i].split(' ')
}
for (i=N; i<N+M; i++) {
  c[i-N] = inp[i].split(' ')
}
for (i=0; i<N; i++) {
  min = 1000000000
  for (j=0; j<M; j++) {
    x = s[i][0] * 1
    y = s[i][1] * 1
    m = Math.abs(c[j][0] - x) + Math.abs(c[j][1] - y)
    if (min > m) {
      min = m
      n = j + 1
    }
  }
  console.log(n)
}
//  [javascript]
'use strict';

const input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
const info = input.shift().split(' ');

const studends = [];

// 生徒がどこにいるかの配列
for(let s_i = 0; s_i < info[0]; s_i++){
	studends.push(input[s_i].split(' '));
}

const checkpoints = [];

// チェックポイントについての配列
for(let c_i = info[0]; c_i < info[1]*1 + info[0]*1; c_i++){
	checkpoints.push(input[c_i].split(' '));
}


for(let s_i = 0; s_i < info[0]; s_i++){
  // minはとりあえずめちゃくちゃ大きな値にする
  let min = Infinity;
  let point_no = null;
  let diff;
  for(let c_i = 0; c_i < checkpoints.length; c_i++){
      diff = 
        Math.abs(checkpoints[c_i][0] - studends[s_i][0])
          + Math.abs(checkpoints[c_i][1] - studends[s_i][1]);
      if(diff < min){
        min = diff;
        //1スタートなので +1 している
        point_no = c_i + 1;
      }
  }
  console.log(point_no);
}
//  [javascript]
var Point = (function () {
  function Point(input) {
    this.x = Number(input[0]);
    this.y = Number(input[1]);
  }
  Point.prototype.getMinManhattanDistance = function(points) {
    var _this = this;
    var minDistance;
    var mostMinIndex = 0;
    points.forEach(function(p, i) {
      var d = Math.abs(_this.x - p.x) + Math.abs(_this.y - p.y);
      if (minDistance === undefined || minDistance > d) {
        mostMinIndex = i;
        minDistance = d;
      }
    });
    return mostMinIndex + 1;
  };
  return Point;
}());

function main(input) {
  var lines = input.split("\n");
  var peopleCount = Number(lines[0].split(" ")[0]);
  var checkPointCount = Number(lines[0].split(" ")[1]);

  var students = [];
  for (var i = 1; i < peopleCount + 1; i++){
    students.push(new Point(lines[i].split(" ")));
  }

  var checkPoints = [];
  for (var i = 1 + peopleCount; i < peopleCount + checkPointCount + 1; i++){
    checkPoints.push(new Point(lines[i].split(" ")));
  }

  students.forEach(function(s) {
    console.log(s.getMinManhattanDistance(checkPoints));
  });
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	
	NM = input[0].split(" ");
	N = parseInt(NM[0], 10);
	M = parseInt(NM[1], 10);
    //console.log('%d %d', N, M);

	var a = [];
	var b = [];
	for (i=1; i <= N; i++){
	  ab = input[1+i-1].split(" ");
	  a[i] = parseInt(ab[0], 10);
	  b[i] = parseInt(ab[1],10);
	  //console.log('%d %d', a[i], b[i]);
	}

	var c = [];
	var d = [];
	for (i=1; i <= M; i++){
	  cd = input[1+N+i-1].split(" ");
	  c[i] = parseInt(cd[0],10);
	  d[i] = parseInt(cd[1],10);
	  //console.log('%d %d', c[i], d[i]);
	}
	//console.log('---');
	
	for (i=1; i <= N; i++){
	  minDistance = 0;
	  minIndex = 0;
	  for (j=1; j <= M; j++){
	    //console.log('=', Math.abs( a[i]-c[j]) + Math.abs(b[i]-d[j]));
	    distance = Math.abs( a[i]-c[j]) + Math.abs(b[i]-d[j]);
	    if (j == 1){
	      minDistance = distance;
	      minIndex = j;
	    } else {
	      if (distance < minDistance){
	        minDistance = distance;
	        minIndex = j;
	      }
	    }
	  }
	  //console.log('---');
	  console.log(minIndex);
	}

	//文字列から10進数に変換するときはparseIntを使います
//	var a = parseInt(input[0], 10);
//	var b = parseInt(tmp[0], 10);
//	var c = parseInt(tmp[1], 10);
//	var s = input[2];
	//出力
//	console.log('%d %s',a+b+c,s);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// ABC157 B - Checkpoints
'use strict';

function Main(input) {
    const tmp = input.trim().split('\n');
    const NM = tmp[0].split(' ');
    const N = Number(NM[0]);
    const M = Number(NM[1]);
    let students = tmp
        .slice(1, N + 1)
        .map((v) => v.split(' ').map((v) => Number(v)));
    const checkpoints = tmp
        .slice(N + 1)
        .map((v) => v.split(' ').map((v) => Number(v)));
    // console.log(N, M, students, checkpoints);

    for (const student of students) {
        let point = -1
        let near = Number.MAX_VALUE;
        for (let i = 0; i < M; i++) {
            const d = distance(student, checkpoints[i]);
            if (d < near) {
                near = d;
                point = i + 1;
            }
        }
        console.log(point);
    }

    return;
}

function distance(a, b) {
    return Math.abs(a[0]- b[0]) + Math.abs(a[1] - b[1]);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var si = bufio.NewScanner(os.Stdin)

func readInt() int {
	si.Scan()
	r, _ := strconv.Atoi(si.Text())
	return r
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func isMinX(x, y int) bool {
	return x < y
}
func main() {
	si.Split(bufio.ScanWords)
	si.Buffer(make([]byte, 0), 10000000)
	N, M := readInt(), readInt()
	var a, b, e, f [50]int
	for i := 0; i < N; i++ {
		a[i], b[i] = readInt(), readInt()
		e[i] = 300000000
	}
	for i := 0; i < M; i++ {
		c, d := readInt(), readInt()
		for j := 0; j < N; j++ {
			if isMinX(abs(a[j]-c)+abs(b[j]-d), e[j]) {
				e[j] = abs(a[j]-c) + abs(b[j]-d)
				f[j] = i + 1
			}
		}
	}
	for i := 0; i < N; i++ {
		fmt.Println(f[i])
	}

}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	resolve()
}

func resolve() {
	n := scanInt(sc)
	m := scanInt(sc)
	ps := make([]pos, n)
	cs := make([]pos, m)
	for i := range loop0(n) {
		ps[i] = pos{x: scanInt(sc), y: scanInt(sc)}
	}
	for i := range loop0(m) {
		cs[i] = pos{x: scanInt(sc), y: scanInt(sc)}
	}
	for _, j := range ps {
		min := math.MaxInt64
		minIdx := -1
		for i, c := range cs {
			v := dist(c, j)
			if min > v {
				min = v
				minIdx = i + 1
			}
		}
		fmt.Println(minIdx)
	}
	return
}

func dist(x, y pos) int {
	return abs(x.x-y.x) + abs(x.y-y.y)
}
func abs(v int) int {
	if v < 0 {
		return -v
	}
	return v
}

type pos struct{ x, y int }

func loop0(n int) chan int {
	return loop(0, n-1, 1)
}

func loop(s, e, d int) chan int {
	ch := make(chan int)
	go func() {
		for i := s; i <= e; i += d {
			ch <- i
		}
		close(ch)
	}()
	return ch
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	scanInit()

	n := nextInt()
	m := nextInt()
	a := make([]int, n)
	b := make([]int, n)
	c := make([]int, m)
	d := make([]int, m)

	for i := 0; i < n; i++ {
		a[i] = nextInt()
		b[i] = nextInt()
	}
	for i := 0; i < m; i++ {
		c[i] = nextInt()
		d[i] = nextInt()
	}

	for i := 0; i < n; i++ {
		x1 := a[i]
		y1 := b[i]
		mdifmin := math.MaxInt64
		mdifminIdx := -1
		for j := 0; j < m; j++ {
			x2 := c[j]
			y2 := d[j]

			mdif := abs(x2-x1) + abs(y2-y1)

			if mdifmin > mdif {
				mdifmin = mdif
				mdifminIdx = j
			}

		}
		fmt.Println(mdifminIdx + 1)
	}

}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

// ---- readfunc
var sc = bufio.NewScanner(os.Stdin)

func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main
 
import (
  "fmt"
)
 
func main() {
  var N, M int
  var a, b, c, d int
  fmt.Scan(&N)
  fmt.Scan(&M)
  
  student := make([][]int, N)
  for i := 0; i < N; i++ {
    student[i] = make([]int, 2)
    fmt.Scan(&a)
    fmt.Scan(&b)
    student[i][0] = a
    student[i][1] = b
  }
  checkpoint := make([][]int, M)
  for i := 0; i < M; i++ {
    checkpoint[i] = make([]int, 2)
    fmt.Scan(&c)
    fmt.Scan(&d)
    checkpoint[i][0] = c
    checkpoint[i][1] = d
  }
  
  for i := 0; i < N; i++ {
    min := 1000000000
    ans := 0
    for j := 0; j < M; j++ {
      dx := student[i][0] - checkpoint[j][0]
      dy := student[i][1] - checkpoint[j][1]
      d := abs(dx) + abs(dy)
      
      if d < min {
        min = d
        ans = j+1
      }
    }
    fmt.Printf("%d\n", ans)
  }  
}

func abs(a int) int {
  if a < 0 {
    a *= -1
  }
  return a
}
//  [ruby]
n, m = gets.split.map(&:to_i)
abs = n.times.map { gets.split.map(&:to_i) }
checks = m.times.map { gets.split.map(&:to_i) }

abs.each do |a, b|
  ans = m
  adist = 2 + 10 ** 8

  (m - 1).downto(0) do |i|
    ca, cb = checks[i]
    dist = (ca - a).abs + (cb - b).abs

    if dist <= adist
      ans = i + 1
      adist = dist
    end
  end

  puts ans
end
//  [ruby]
# frozen_string_literal: true

n, m = gets.split.map(&:to_i)
a, b = Array.new(n) { gets.split.map(&:to_i) }.transpose
c, d = Array.new(m) { gets.split.map(&:to_i) }.transpose

n.times do |i|
  min = 4 * 10**8 + 1
  checkpoint = nil

  m.times do |j|
    tmp = (a[i] - c[j]).abs + (b[i] - d[j]).abs

    if min > tmp
      min = tmp
      checkpoint = j + 1
    end
  end

  puts checkpoint
end
//  [ruby]
# https://atcoder.jp/contests/abc057/tasks/abc057_b



N, M = gets.split.map(&:to_i)
as = Array.new(N)
bs = Array.new(N)
N.times do |i|
  as[i], bs[i] = gets.split.map(&:to_i)
end
cs = Array.new(M)
ds = Array.new(M)
M.times do |i|
  cs[i], ds[i] = gets.split.map(&:to_i)
end

ans = []

N.times do |i|
  d = 4 * (10 ** 8)
  checkpoint = 0
  M.times do |j|
    temp = (as[i] - cs[j]).abs + (bs[i] - ds[j]).abs
    if temp < d
      d = temp
      checkpoint = j + 1
    end
  end
  ans << checkpoint
end
puts ans
//  [ruby]
def metric(student,point)
  return (student[0] - point[0]).abs + (student[1] - point[1]).abs
end
n,m = gets.chomp.split(' ').map(&:to_i)
students = []
points = []
n.times do
  students.push(gets.chomp.split(' ').map(&:to_i))
end
m.times do
  points.push(gets.chomp.split(' ').map(&:to_i))
end
students.each do |student|
  min = 10**10
  min_idx = 100
  points.each_with_index do |point,idx|
    metric = metric(student,point)
    if metric < min
      min = metric
      min_idx = idx + 1
    end
  end
  puts min_idx
end
//  [ruby]
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n,@m = gets.to_s.split.map{ |v| v.to_i }
    @a,@b = Array.new(n){ gets.to_s.split.map{ |v| v.to_i } }.transpose
    @c,@d = Array.new(m){ gets.to_s.split.map{ |v| v.to_i } }.transpose
  end

  def len(a,b,c,d)
    (a-c).abs + (b-d).abs
  end

  def solve
    ans = []
    n.times do |i|
      lens = m.times.map{|j|len(a[i],b[i],c[j],d[j])}
      mini = lens.min
      k = lens.find_index(mini)
      ans << k + 1
    end
    ans
  end

  def show(ans)
    ans.each do |a|
      puts a
    end
  end
end

Problem.new.instance_eval do
  show(solve)
end
//  [ruby]
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,M=get_i
ab=array(N)
N.times do|i|
  ab[i]=get_i
end
cd=array(M)
M.times do|i|
  cd[i]=get_i
end
ab.each do|x,y|
    min_i=0
    M.times do|j|
        val=(x-cd[j][0]).abs+(y-cd[j][1]).abs
        if val<((x-cd[min_i][0]).abs+(y-cd[min_i][1]).abs)
            min_i=j
        end
    end
    puts min_i+1
end
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i64> = procon_read();
	let n = v[0];
	let m = v[1];
	let mut a:Vec<i64> = Vec::new();
	let mut b:Vec<i64> = Vec::new();
	let mut c:Vec<i64> = Vec::new();
	let mut d:Vec<i64> = Vec::new();
	for i in 0..n {
		let v:Vec<i64> = procon_read();
		a.push(v[0]);
		b.push(v[1]);
	}
	for i in 0..m {
		let v:Vec<i64> = procon_read();
		c.push(v[0]);
		d.push(v[1]);
	}
	for i in 0..n {
		let mut point = 1;
		let mut mini = (a[i as usize] - c[0]).abs() + (b[i as usize] - d[0]).abs();
		for j in 1..m {
			let cur = (a[i as usize] - c[j as usize]).abs() + (b[i as usize] - d[j as usize]).abs();
			if mini > cur {
				mini = cur;
				point = j + 1;
			}
		}
		println!("{}", point);
	}
	
	
}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::min;

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut students: Vec<(i64, i64)> = vec![];
    let mut checkmarks: Vec<(i64, i64)> = vec![];

    for _ in 0..n {
        let a: i64 = read();
        let b: i64 = read();
        students.push((a, b));
    }
    for _ in 0..m {
        let c: i64 = read();
        let d: i64 = read();
        checkmarks.push((c, d));
    }

    for s in &students {
        let mut minv: i64 = std::i64::MAX;
        let mut minpoint = 0;
        for i in 0..checkmarks.len() {
            let ci = checkmarks[i];
            let dist = (ci.0 - s.0).abs() + (ci.1 - s.1).abs();
            if dist < minv {
                minv = dist;
                minpoint = i;
            }
        }
        println!("{}", minpoint +1);
    }
}
//  [rust]
#![allow(unused)]

use std::cmp::{max, min};
use std::io::stdin;
use std::str::FromStr;

fn input<T: FromStr>() -> Result<T, T::Err> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse()
}

fn input_vec<T: FromStr>() -> Result<Vec<T>, T::Err> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().split_whitespace().map(|x| x.parse()).collect()
}

fn main() {
    let (n, m): (usize, usize) = {
        let tmp = input_vec().unwrap();
        (tmp[0], tmp[1])
    };

    let mut stu: Vec<(i64, i64)> = Vec::with_capacity(n);
    for _i in 0..n {
        let tmp = {
            let t = input_vec().unwrap();
            (t[0], t[1])
        };
        stu.push(tmp);
    }

    let mut chk: Vec<(i64, i64)> = Vec::with_capacity(m);
    for _i in 0..m {
        let tmp = {
            let t = input_vec().unwrap();
            (t[0], t[1])
        };
        chk.push(tmp);
    }

    for &(a, b) in stu.iter() {
        let mut closest = m + 1;
        let mut ord = std::usize::MAX;

        for (i, &(c, d)) in chk.iter().enumerate().rev() {
            if ord
                >= ((a as i64) - (c as i64)).abs() as usize
                    + ((b as i64) - (d as i64)).abs() as usize
            {
                closest = i;
                ord = ((a as i64) - (c as i64)).abs() as usize
                    + ((b as i64) - (d as i64)).abs() as usize;
            }
        }

        println!("{}", closest + 1);
    }
}
//  [rust]
use whiteread::parse_line;

fn main() {
    let (n, m): (usize, usize) = parse_line().unwrap();
    let mut ab: Vec<(i64, i64)> = Vec::new();
    let mut cd: Vec<(i64, i64)> = Vec::new();

    for _ in 0..n {
        ab.push(parse_line().unwrap());
    }
    for _ in 0..m {
        cd.push(parse_line().unwrap());
    }

    for &(a, b) in &ab {
        let mut min = std::i64::MAX;
        let mut ans = 0;
        for (i, (c, d)) in cd.iter().enumerate() {
            let dist = (c - a).abs() + (d - b).abs();
            if dist < min {
                min = dist;
                ans = i + 1;
            }
        }
        println!("{}", ans);
    }
}
//  [swift]
let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (N, M) = (input[0], input[1])
let student = (0..<N).map{_ in readLine()!.characters.split(" ").map{Int(String($0))!}}
let checkpoint = (0..<M).map{_ in readLine()!.characters.split(" ").map{Int(String($0))!}}
for i in 0..<N {
    var ans = 1
    var minDist = abs(student[i][0] - checkpoint[0][0]) + abs(student[i][1] - checkpoint[0][1])
    for j in 1..<M {
        let dist = abs(student[i][0] - checkpoint[j][0]) + abs(student[i][1] - checkpoint[j][1])
        if dist < minDist {
            minDist = dist
            ans = j + 1
        }
    }
    print(ans)
}
//  [swift]
let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (N, M) = (input[0], input[1])
var student = (0..<N).map{_ in readLine()!.characters.split(" ").map{Int(String($0))!}}
var checkpoint = (0..<M).map{_ in readLine()!.characters.split(" ").map{Int(String($0))!}}
for i in 0..<N {
    var ans = 0
    var minDist = 400000001
    for j in 0..<M {
        let dist = abs(student[i][0] - checkpoint[j][0]) + abs(student[i][1] - checkpoint[j][1])
        if dist < minDist {
            minDist = dist
            ans = j + 1
        }
    }
    print(ans)
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (N, M) = (input[0], input[1])
var student = [[Int]]()
var checkpoint = [[Int]]()
for _ in 0..<N {
    student += [readIntSplit(by: " ")]
}
for _ in 0..<M {
    checkpoint += [readIntSplit(by: " ")]
}
for i in 0..<N {
    var ans = 0
    var minDist = 400000001
    for j in 0..<M {
        let dist = abs(student[i][0] - checkpoint[j][0]) + abs(student[i][1] - checkpoint[j][1])
        if dist < minDist {
            minDist = dist
            ans = j + 1
        }
    }
    print(ans)
}
//  [swift]
import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let (n, m) = toTuple(readInts())
var aibi: [(Int, Int)] = []
var cidi: [(Int, Int)] = []
for _ in 0..<n {
  aibi.append(toTuple(readInts()))
}
for _ in 0..<m {
  cidi.append(toTuple(readInts()))
}
for ab in aibi {
  var di: [Int] = []
  for cd in cidi {
    di.append(abs(ab.0 - cd.0) + abs(ab.1 - cd.1))
  }
  print(di.firstIndex(of: di.min()!)! + 1)
}
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let [n,m]=tnn(2),r1=[],r2=[]
  for(let i=0;i<n;i++){
    r1.push([tn(),tn()])
  }
  for(let i=0;i<m;i++){
    r2.push([tn(),tn()])
  }
  for(let i=0;i<n;i++){
    let d=Infinity,a;
    for(let j=m-1;0<=j;j--){
      const m=abs(r1[i][0]-r2[j][0])+abs(r1[i][1]-r2[j][1])
      if(d>=m){
        d=m
        a=j+1
      }
    }
    to(a)
  }

}
main()
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [N] = input[0].map(Number);
  const students = input.slice(1, N + 1).map((line) => line.map(Number));
  const checkpoints = input.slice(N + 1, -1).map((line) => line.map(Number));

  const answer: number[] = [];

  students.forEach(([a, b]) => {
    let minDistance = Number.MAX_SAFE_INTEGER;
    let checkpoint = 0;

    checkpoints.forEach(([c, d], index) => {
      const currentDistance = Math.abs(c - a) + Math.abs(d - b);

      if (currentDistance < minDistance) {
        minDistance = currentDistance;
        checkpoint = index + 1;
      }
    });

    answer.push(checkpoint);
  });

  return answer.join("\n");
};

console.log(main(read()));
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [N] = input[0].map(Number);
  const checkpoints = input.slice(N + 1, -1).map((line) => line.map(Number));

  const answer: number[] = [];

  for (let i = 1; i <= N; i++) {
    const [a, b] = input[i].map(Number);

    let minDistance = Number.MAX_SAFE_INTEGER;
    let candidate = 0;

    checkpoints.forEach(([c, d], j) => {
      const distance = Math.abs(c - a) + Math.abs(d - b);

      if (distance < minDistance) {
        minDistance = distance;
        candidate = j + 1;
      }
    });

    answer.push(candidate);
  }

  return answer.join("\n");
};

console.log(main(read()));
//  [typescript]
import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf-8");

function Main(input: string) {
  const [NM, ...abcd] = input.split("\n");
  const [N] = NM.split(" ").map((str) => Number(str));
  const AB = abcd.slice(0, N);
  const CD = abcd.slice(N, -1);
  AB.forEach((ab) => {
    const [a, b] = ab.split(" ").map((str) => Number(str));
    const distances = CD.map((cd) => {
      const [c, d] = cd.split(" ").map((str) => Number(str));
      const tmp = Math.abs(a - c) + Math.abs(b - d);
      return tmp;
    });
    const min = distances.reduce((x, y) => Math.min(x, y));
    console.log(distances.indexOf(min) + 1);
  });
}

Main(input);
//  [python]
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    D, T, S = map(int, input().split())
    if T*S >= D:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    solve()