Suki's Treasure Bounding Box
Suki has buried treasures at various locations in her n×m garden grid. She wants to fence off the smallest axis-aligned rectangular region that contains all the treasures. Given the coordinates of all treasures, find the bounding box—the rectangle with the minimum and maximum row and column indices.
Input
The first line contains three integers n, m, and k (1 ≤ n, m ≤ 1000, 1 ≤ k ≤ n·m): the height and width of the garden grid, and the number of treasures buried.
The next k lines each contain two integers r and c (0 ≤ r < n, 0 ≤ c < m): the row and column coordinates of each treasure.
All treasure locations are distinct.
Output
Print four space-separated integers: min_row, max_row, min_col, max_col, representing the bounds of the bounding box that contains all treasures (inclusive).
Notes
The bounding box is the smallest axis-aligned rectangle with sides parallel to the grid edges that contains every treasure location.