Problem Statement
You are given queries, each of the following form, either:
where
is some integer, or
where
is some integer Imagine you start with an empty collection of numbers. When you see
you should add
to your collection of numbers. Every time you see
you should determine the first thing less than or equal to
in your collection of numbers. ## Input Format
Your first line will contain .
Your next
lines will contain one query each.
Output Format
For each query you should output the first thing less than or equal to
in your current collection of numbers. If there is nothing less than or equal to
, output
.
Constraints
## Sample Cases
Input 1
7
INSERT 10
SEARCH 9
INSERT 3
INSERT 4
INSERT 8
SEARCH 3
SEARCH 7
Output 1
-1
3
4
Comments