Dynamic Convex Hull

아직 제출이 없습니다시간 제한4초메모리 제한512 MB

문제

Let's first see a related classical algorithm to help you solve this problem: You will be given nn functions f_1(x),f_2(x),,f_n(x)f\_1(x),f\_2(x),\dots,f\_n(x), where f_i(x)=a_ix+b_if\_i(x)=a\_ix+b\_i. When you want to find the minimum value of f_i(x)f\_i(x) over all ii for a fixed parameter xx, you just need to find the corresponding function on the convex hull.

Now you will be given nn functions f_1(x),f_2(x),,f_n(x)f\_1(x),f\_2(x),\dots,f\_n(x), where f_i(x)=(xa_i)4+b_if\_i(x)=(x-a\_i)^4+b\_i.

You need to perform mm operations. Each operation has one of the following forms:

  • "1 aa bb" (1a50,0001 \leq a \leq 50\\,000, 1b10181 \leq b \leq 10^{18}): Add a new function f_n+1(x)=(xa)4+bf\_{n+1}(x)=(x-a)^4+b and then change nn into n+1n+1.
  • "2 tt" (1tn1 \leq t \leq n): Delete the function f_t(x)f\_{t}(x). It is guaranteed that each function won't be deleted more than once.
  • "3 xx" (1x50,0001 \leq x \leq 50\\,000): Query for the minimum value of f_i(x)f\_i(x), where 1in1 \leq i \leq n and the function f_i(x)f\_i(x) has not been deleted yet.

입력

The first line contains a single integer TT (1T51 \leq T \leq 5), the number of test cases. For each test case:

The first line contains two integers nn and mm (1n,m100,0001 \leq n, m \leq 100\\,000) denoting the number of functions and the number of operations.

Each of the following nn lines contains two integers a_ia\_i and b_ib\_i (1a_i50,0001 \leq a\_i \leq 50\\,000, 1b_i10181 \leq b\_i \leq 10^{18}), denoting the ii-th function f_i(x)f\_i(x).

Each of the next mm lines describes an operation in the format shown above.

출력

For each query, print a single line containing an integer denoting the minimum value of f_i(x)f\_i(x). When there are no functions, print "-1" instead.