F. Number Theory

    传统题 2000ms 256MiB

Number Theory

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

Libra and Rahn are playing a game of number.

Rahn has a set of two-tuples {(ai,bi)}\{(a_i,b_i)\}, where aia_i and bib_i are both non-negative integers. Initially, the set is empty.

Libra has tt operatons which has three types for Rahn's set:

  1. Add a two-tuple (ai,bi)(a_i,b_i) to Rahn's set.
  2. Remove a single two-tuple (ai,bi)(a_i,b_i) from Rahn's set. It is guaranteed that there is at least one (ai,bi)(a_i,b_i) in the set.
  3. Given a integer cc, find the maxinum value of min(ai,bi+c)\min(a_i,b_i+c), where (ai,bi)(a_i,b_i) is an element in Rahn's set. It is guaranteed that there is at least one two-tuple in the set.

Format

Input

The first line contains an integer t(0t106)t(0\le t\le 10^6) representing the number of operations. For the following tt lines, the first integer opop on each line represents the type of the current operation.

  • If op=1op=1, the next two integers are aia_i and bib_i, representing Libra adds (ai,bi)(a_i,b_i) to Rahn's set.
  • If op=2op=2, the next two integers are aia_i and bib_i, representing Libra removes (ai,bi)(a_i,b_i) from Rahn's set.
  • If op=3op=3, the next integer is cc. You should output the maximum value of min(ai,bi+c)\min(a_i,b_i+c) in the set.

It is guaranteed that all the values of a,b,ca,b,c are integers in range [0,106][0,10^6].

Output

For each operation with op=3op = 3, output a line with an integer representing the answer.

Samples

9
1 200000 20000
1 150000 40000
1 120000 50000
1 130000 30000
3 80000
3 100000
3 140000
2 150000 40000
3 100000
120000
140000
160000
130000

五一欢乐训练赛

未参加
状态
已结束
规则
ACM/ICPC
题目
6
开始于
2023-5-2 14:00
结束于
2023-5-2 18:00
持续时间
4 小时
主持人
参赛人数
6