A warehouse control system stores a number in each indexed bin. Starting with all bins empty, it processes q operations, each one of:
SET index number— placenumberinto binindex, replacing whatever was there.FIND number— report the smallest binindexcurrently holdingnumber, or-1if no bin currently holds it.
Input format
Line 1: an integer q.
Next q lines: SET index number or FIND number.
Output format
For each FIND operation, in order, print the smallest matching index, or -1.
Constraints
- 1 <= q <= 40
- 1 <= index <= 1000000
- 1 <= number <= 1000000