#K41052. Bounding Rectangle
Bounding Rectangle
Bounding Rectangle
You are given several test cases. In each test case, you are provided with the coordinates of trees planted on a field. Your task is to compute the smallest axis-aligned rectangle that completely encloses all the given trees. The rectangle is defined by its bottom-left corner (x₁, y₁) and top-right corner (x₂, y₂).
Recall that for a set of points with coordinates ({(x_i,y_i)}), the rectangle's corners are given by: (x_1 = \min_{i} x_i), (y_1 = \min_{i} y_i), (x_2 = \max_{i} x_i), (y_2 = \max_{i} y_i).
The sides of the rectangle are parallel to the coordinate axes.
inputFormat
The input is read from standard input (stdin). The first line contains an integer T representing the number of test cases. The descriptions of the T test cases follow. For each test case:
- The first line contains an integer N, the number of trees.
- Each of the next N lines contains two space-separated integers representing the x and y coordinates of a tree.
outputFormat
For each test case, output one line to standard output (stdout) containing four integers: x₁, y₁, x₂, y₂. These denote the coordinates of the bottom-left and top-right corners of the bounding rectangle respectively.## sample
2
4
1 3
4 4
2 2
3 1
3
-1 -2
0 0
1 1
1 1 4 4
-1 -2 1 1
</p>