Have you played the can tower? Put the cans one by one on the can tower lead to much happiness to me. Today I will play the can tower again. I will play 3 kinds of operations as followed.
1. Put w: I will put a new can on the top of the can tower and w is the weight of the current can. Note that at the beginning the can tower has 0 cans.
2. Take: I will take away the top can of the can tower.
3. Query: I want to know the kth lightest can’s weight in the current can tower. Note that the k is given at the beginning of the game.
For each“Take”operation , please output the top can's weight before being taken away.
For each“Query”operation , please output the kth lightest can's weight. If the number of cans in can tower is smaller than the k , please output the heavest can's weight in the current can tower.