#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 requests:
add x y: add point . It is guaranteed not to exist yet.remove x y: remove point . It is guaranteed to exist.find x y: among all marked points with and , choose the point with smallest . If several points have that , choose the one with smallest .
All coordinates are non-negative and at most .
Input
The first line contains .
The next lines describe the requests.
Output
For every find, print x' y'. If no valid point exists, print -1.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: .
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.