#C1181. Nearest Treasure

    ID: 41167 Type: Default 1000ms 256MiB

Nearest Treasure

Nearest Treasure

You are given a starting coordinate and a list of treasure coordinates. Your task is to determine the treasure that is closest to the starting point using the Euclidean distance formula, given by (\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}). In case of a tie, output the coordinate that appears first in the list.

inputFormat

The input is read from standard input (stdin). The first line contains two integers (x) and (y) representing the starting point. The second line contains an integer (n), the number of treasures. This is followed by (n) lines, each containing two integers representing the (x) and (y) coordinates of a treasure.

outputFormat

Print the coordinates of the nearest treasure as two space-separated integers to standard output (stdout).## sample

0 0
1
3 4
3 4