#C8939. Optimal Meeting Point

    ID: 52976 Type: Default 1000ms 256MiB

Optimal Meeting Point

Optimal Meeting Point

Given N friends located on a 2D grid, find the optimal meeting point that minimizes the maximum distance any friend has to travel. The meeting point is determined by taking the median of the x-coordinates and the median of the y-coordinates. In case of an even number of points, the coordinate is computed as the floor of the average of the two middle values. If multiple answers exist, choose one with the smallest x coordinate; if there is still a tie, choose the one with the smallest y coordinate.

This problem emphasizes fairness in travel distance and requires careful implementation to handle both odd and even cases efficiently.

inputFormat

The input is read from standard input (stdin). The first line contains an integer N (1 ≤ N ≤ 10^5), the number of friends. Each of the following N lines contains two space-separated integers representing the x and y coordinates of each friend's location.

outputFormat

Output to standard output (stdout) two space-separated integers representing the x and y coordinates of the optimal meeting point.

## sample
3
0 0
1 1
0 2
0 1