1912: 【CSP二维数组】游览动物园█

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:1 Solved:1

Description

动物园有很多游览区,小红已经在动物园的一个游览区游览,突然接到电话,要半个小时内到动物园外面跟一个朋友见面。半个小时小红只够游览完当前区域之后,游览一个最近的景区。

已知从一个游览区域只能沿着地图(地图的长宽均小于 lns="http://www.w3.org/1998/Math/MathML">100 )中的直线走(上下左右四个方向),请问离小红当前游览区的最近的一个游览区的坐标是多少,如果有多个点离小红的位置都很近,请输出离出口最近的那个点的坐标(不存在多个点距离出口一样近)?

例如:假设小红在孔雀区( lns="http://www.w3.org/1998/Math/MathML">3,2 ),离小红最近的 lns="http://www.w3.org/1998/Math/MathML">2 处游览区分别是猴山( lns="http://www.w3.org/1998/Math/MathML">2,0 )和虎山( lns="http://www.w3.org/1998/Math/MathML">5,3 ),但猴山离入口更近,因此输出猴山的坐标。


Input

第一行 lns="http://www.w3.org/1998/Math/MathML">2 个变量,为小红所在的游览区的坐标

第二行一个整数 lns="http://www.w3.org/1998/Math/MathML">n ,为该动物园内游览区的数量( lns="http://www.w3.org/1998/Math/MathML">n100 )

接下来的 lns="http://www.w3.org/1998/Math/MathML">n 行,每行 lns="http://www.w3.org/1998/Math/MathML">2 个数,代表动物园的 lns="http://www.w3.org/1998/Math/MathML">n 个游览区的坐标(本题所有的坐标值都在 lns="http://www.w3.org/1998/Math/MathML">11000 的范围内)

Output

离小红最近的游览区的坐标

Sample Input Copy

3 2
5
2 0 
5 3
3 2
5 5
3 8

Sample Output Copy

2 0