Rectangular Queries
Given N points on a plane, each associated with a specific value, you need to efficiently handle two types of queries:
Assign a value K to all points within the rectangular area defined by [x_1..x_2] and [y_1..y_2].
Determine the point with the minimum value within the rectangular area [x_1..x_2] and [y_1..y_2].
Input
You are given the number of points N (1 ≤ N ≤ 262144), followed by N points. Each point is specified by three numbers: x, y, and an initial value.
Next, you are given the number of queries M (1 ≤ M ≤ 10^4), followed by M queries. Queries are formatted as = x_1 y_1 x_2 y_2 value for assigning values, and ? x_1 y_1 x_2 y_2 for finding the minimum value.
All coordinates are within the range of -10^9 to 10^9. All values are between 0 and 10^9.
Output
For each ? query, output the minimum value of the points within the specified rectangle. If there are no points in the rectangle, output NO.