A sensor feed reports prices tagged by timestamp, and may correct an earlier report. It processes q operations, each one of:
UPDATE t price— record that at timestamptthe price isprice. Iftwas reported before, this correction overwrites the earlier value for that timestamp.CURRENT— report the price at the latest (largest) timestamp seen so far.MAX— report the maximum price among the current (corrected) records.MIN— report the minimum price among the current (corrected) records.
It is guaranteed that at least one UPDATE occurs before any query.
Input format
Line 1: an integer q.
Next q lines: UPDATE t price, CURRENT, MAX, or MIN.
Output format
For each CURRENT, MAX, and MIN operation, in order, print the requested price.
Constraints
- 1 <= q <= 40
- 0 <= t <= 1000000
- 1 <= price <= 1000000