#SGM0000025. Các điểm (Points)

Các điểm (Points)

Points

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Maintain a set of integer points on the plane, initially empty. There are nn requests:

  • add x y: add point (x,y)(x,y). It is guaranteed not to exist yet.
  • remove x y: remove point (x,y)(x,y). It is guaranteed to exist.
  • find x y: among all marked points (x′,y′)(x',y') with x′>xx'>x and y′>yy'>y, choose the point with smallest x′x'. If several points have that x′x', choose the one with smallest y′y'.

All coordinates are non-negative and at most 10910^9.

Input

The first line contains nn.

The next nn lines describe the requests.

Output

For every find, print x' y'. If no valid point exists, print -1.

Subtasks

  • Subtask 1 — 20%: 1≤n≤501\le n\le50.
  • Subtask 2 — 30%: 1≤n≤50001\le n\le5000.
  • Subtask 3 — 50%: 1≤n≤2⋅1051\le n\le2\cdot10^5.

Examples

Input

7
add 1 1
add 3 4
find 0 0
remove 1 1
find 0 0
add 1 1
find 0 0

Output

1 1
3 4
1 1

Explanation

The sample is processed in order; every printed item/line corresponds to an operation that requires output.