Problem hidden

ALLIN1 - All in One

Before you begin, you should try this problem! AVL Tree

This problem is simple. Initially, there is a list and it is empty. Then you are given four types of query:

  1. Insert data to the list.
  2. Remove data from the list.
  3. Print an index (1-based) from a specified data after the list was sorted ascendingly.
  4. Print data from a specified index (1-based) after the list was sorted ascendingly.

Input

Input contains several lines. Each line follows one of these formats.

  • 1 n: Insert n (0 ≤ n ≤ 231 - 1) to the list.
  • 2 n: Remove n from the list. If n was not found, do nothing.
  • 3 n: Print n's index (1-based) after the list was sorted ascendingly.
  • 4 i: Print data at i-th index (1-based) after the list was sorted ascendingly (0 ≤ i ≤ 231 - 1).
  • -1: End of input.

Output

For each query 3, print n's index in one line. If n was not found, just print -1.

For each query 4, print data on i-th index in one line. If the index is not valid, just print -1.

Example

Input:
3 20
-1

Output:
-1

Adicionado por:Lucas
Data:2017-04-22
Tempo limite:1s-1.350s
Tamanho do fonte:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Linguagem permitida:Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.