unittest
{
	assert( [ "2 2", "2 0", "0 0", "-1 0", "1 0" ].parse.expand.solve == "2\n1" );
	assert( [ "3 4", "10 10", "-10 -10", "3 3", "1 2", "2 3", "3 5", "3 5" ].parse.expand.solve == "3\n1\n2" );
	assert( [
		"5 5",
		"-100000000 -100000000",
		"-100000000 100000000",
		"100000000 -100000000",
		"100000000 100000000",
		"0 0",
		"0 0",
		"100000000 100000000",
		"100000000 -100000000",
		"-100000000 100000000",
		"-100000000 -100000000"
	].parse.expand.solve == "5\n4\n3\n2\n1" );
}



import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nm = input.front.split.to!( long[] );
	auto abs = new long[ 2 ][ nm[ 0 ] ];
	foreach( ref ab; abs )
	{
		input.popFront;
		ab = input.front.split.to!( long[] );
	}
	auto cds = new long[ 2 ][ nm[ 1 ] ];
	foreach( ref cd; cds )
	{
		input.popFront;
		cd = input.front.split.to!( long[] );
	}
	return tuple( abs, cds );
}

auto solve( long[ 2 ][] abs, long[ 2 ][] cds )
{
	auto anss = new long[ abs.length ];
	
	foreach( ref ans, ab; lockstep( anss, abs ) )
	{
		auto dm = long.max;
		
		foreach( i, cd; cds )
		{
			auto d = ( ab[ 0 ] - cd[ 0 ] ).abs + ( ab[ 1 ] - cd[ 1 ] ).abs;
			if( d < dm )
			{
				dm = d;
				ans = i + 1;
			}
		}
	}
	
	return anss.map!( to!string ).join( "\n" );
}
