V_AYP2_E - Lazy Decision

Español

Samuel is a pretty intelligent Young man. He recently completed high school and thanks to his high IQ he was given the opportunity of choosing which University he wanted to continue his education in. Although he is very smart, he is extremely lazy.

His primary concern is not how good the university is but how close it is to his home as he really hates getting up early. Write a program that helps Samuel in this decision as it is a loss of his precious time to think about this issue.

 

Input details:

The first line of the input will have an integer T with the number of test cases, each case will have an integer N indicating the number of universities that Samuel can choose. These universities will be ordered from best to worse (first in the list is the best, last in the list will be the worse).The next line will contain 2 coordinates, (Px,Py) indicating the position of Samuel ́s house. N lines will follow each containing 2 numbers Xi,Yi that represent the location (coordinates) of university i.

 

Output details:

The output will contain three numbers X,Y,Z. X and Y represent the coordinates of the closest university to Samuel ́s house, Z will represent the minimum distance to the university. In case 2 universities have the same distance to Samuel ́s house, he will choose the best between them. Consider that in Samuel ́s city the only way to move about is horizontally and vertically, there are no shortcuts as taking diagonals.

 

INPUT

OUTPUT

1

2

0 0

1 1

2 2

1 1 2

 

Constraints:

0<T<10000

0<N<10000

0<xi<1000000

0<yi<1000000 


Added by:Venezuelan Programming League
Date:2013-02-02
Time limit:4s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.